简体   繁体   English

如何使傅立叶变换正确?

[英]how to get the Fourier transform correct?

I am processing this image: 我正在处理此图像: 在此处输入图片说明

and i will like to get this result: 我想得到这个结果: 在此处输入图片说明

Instead I'm getting this: 相反,我得到这个: 在此处输入图片说明

This is part of the code: 这是代码的一部分:

// Convert the raw images to vectors
    PF_PixelFloat* pixelPointerAtIndex;
    for (unsigned long index= 0; index < imgArraySize; index++){
        pixelPointerAtIndex = (PF_PixelFloat*)((char*)inWorld.data + (index * sizeof(PF_PixelFloat)));
        imgRedDataVector.push_back( (std::complex<double>) pixelPointerAtIndex->red);
        imgGreenDataVector.push_back((std::complex<double>) pixelPointerAtIndex->green);
        imgBlueDataVector.push_back((std::complex<double>) pixelPointerAtIndex->blue);
    }

// Fourier Transform
    fft::transform(imgRedDataVector);
    fft::transform(imgGreenDataVector);
    fft::transform(imgBlueDataVector);

// Copy the Fourier data back to the image
    for (unsigned long index = 0; index < imgArraySize; index++) {
        pixelPointerAtIndex = (PF_PixelFloat*)((char*)inWorld.data + (index * sizeof(PF_PixelFloat)));
        pixelPointerAtIndex->red    = imgRedDataVector[index].real();
        pixelPointerAtIndex->green  = imgGreenDataVector[index].real();
        pixelPointerAtIndex->blue   = imgBlueDataVector[index].real();
    }

I also have try: 我也有尝试:

finalImgRedDataVector[index].imag()
...

It seams like I am getting the "Argument" and I need the "Modulus" 好像我正在获取“参数”,而我需要“模量”

Any body knows what is wrong with this or what I'm missing? 任何人都知道这是什么问题或我缺少什么?

Im using FftComplex.h 我正在使用FftComplex.h

Thanks. 谢谢。

You're not getting the "Argument" either. 您也不会得到“参数”。 Complex numbers have two parts, "real" and "imaginary". 复数有两个部分,“实”和“虚”。 Picturing them as X and Y coordinate, the argument is the angle they make, and magnitude is the distance to the origin. 将它们描绘为X和Y坐标,自变量是它们形成的角度,量级是到原点的距离。 It's the magnitude which is depicted in the second image. 第二幅图描述的是幅度。

In C++, that's abs(std::complex) 在C ++中,这是abs(std::complex)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM