void fft2(IplImage *src, IplImage *dst)
{ //实部、虚部
IplImage *image_Re = 0, *image_Im = 0, *Fourier = 0;
// int i, j;
image_Re = cvCreateImage(cvGetSize(src), IPL_DEPTH_64F, 1); //实部
//Imaginary part
image_Im = cvCreateImage(cvGetSize(src), IPL_DEPTH_64F, 1); //虚部
//2 channels (image_Re, image_Im)
Fourier = cvCreateImage(cvGetSize(src), IPL_DEPTH_64F, 2);
// Real part conversion from u8 to 64f (double)
cvConvertScale(src, image_Re);
// Imaginary part (zeros)
cvZero(image_Im);
// Join real and imaginary parts and stock them in Fourier image
cvMerge(image_Re, image_Im, 0, 0, Fourier);
// Application of the forward Fourier transform
cvDFT(Fourier, dst, CV_DXT_FORWARD);
cvReleaseImage(&image_Re);
cvReleaseImage(&image_Im);
cvReleaseImage(&Fourier);
}
void fft2shift(IplImage *src, IplImage *dst)
{
IplImage *image_Re = 0, *image_Im = 0;
int nRow, nCol, i, j, cy, cx;
double scale, shift, tmp
opencv 中 傅里叶变换 FFT
最新推荐文章于 2024-08-01 03:20:53 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)