gfourier.h
来自「一个由Mike Gashler完成的机器学习方面的includes neural」· C头文件 代码 · 共 60 行
H
60 行
/* Copyright (C) 2006, Mike Gashler This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. see http://www.gnu.org/copyleft/lesser.html*/#ifndef __GFOURIER_H__#define __GFOURIER_H__class GImage;struct ComplexNumber{ double real; double imag; void Multiply(struct ComplexNumber* pOther) { double t = real * pOther->real - imag * pOther->imag; imag = real * pOther->imag + imag * pOther->real; real = t; }};// Fourier transformclass GFourier{public: // This will do a Fast Forier Transform. nArraySize must be a power of 2. If bForward is // false, it will perform the reverse transform static bool FFT(int nArraySize, struct ComplexNumber* pComplexNumberArray, bool bForward); // 2D Fast Forier Transform. nArrayWidth must be a power of 2. nArrayHeight must be a power of 2. If bForward // is false, it will perform the reverse transform. static bool FFT2D(int nArrayWidth, int nArrayHeight, struct ComplexNumber* p2DComplexNumberArray, bool bForward); // pArrayWidth returns the width of the array and pOneThirdHeight returns one third the height of the array // (in other words, the height used by each of the three RGB channels) static struct ComplexNumber* ImageToFFTArray(GImage* pImage, int* pArrayWidth, int* pOneThirdHeight); // nArrayWidth is the width of the array. nOneThirdHeight is one third the height of the array. pImage is assumed // to already be allocated and set to the size of the image embedded in the array. normalize specifies whether or // not to ajust the pixel values to use their full range. static void FFTArrayToImage(struct ComplexNumber* pArray, int nArrayWidth, int nOneThirdHeight, GImage* pImage, bool normalize);#ifndef NO_TEST_CODE static void Test();#endif // NO_TEST_CODE};#endif // __GFOURIER_H__
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?