FFT图像转换的输入和输出应该是什么? [英] What should be the input and output for an FFT image transformation?

查看:415
本文介绍了FFT图像转换的输入和输出应该是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Java中的FFT Cooley-Tukey算法获得灰度图像的光谱。
我不知道如何形成算法的输入以及输出中用于形成光谱图像的值。



目前我的输入是一个复数数组,Re = 8bit灰度域中像素的值,Im = 0;
运行算法后,我获得了另一个复数数组,其实部具有[0,255]范围和虚部0的很多值。
我试图用实数创建一个图像数组模数256。



这是频谱的外观:



这就是我所拥有的:





显然我做了一些可怕的错误,但是我不知道是什么。

解决方案

您没有提供源代码......


  1. 您的结果看起来像解析树



    用于递归解析/频率信息缩放和特征提取不是 FFT !!!因此,您的递归可能是错误的,或者您重叠数据(就地编码 FFT 几乎是精神错乱)您应该从 1D 转换开始,然后将其用于 2D 并目视检查每个阶段(也是逆变换以匹配原始数据)


  2. 您的FFT输出应该具有非零虚部!!!



    在这里查看


    I try to obtain the spectrum of an grayscale image using FFT Cooley–Tukey algorithm in Java. I don't know exactly how to form the input for the algorithm and what values from the output to use in order to form the spectrum image.

    Currently my input is an array of complex numbers, with Re = value of the pixel in 8bit grayscale domain and Im = 0; After running the algorithm I obtain another array of complex numbers with the real part having a lot of values out of [0,255] range and imaginary part 0. I have tried to create an image from the real numbers array modulo 256.

    This is how the spectrum should look:

    And this is what I've got:

    Obviously I'me doing something terrible wrong but I don't know what.

    解决方案

    You did not provide your source code ...

    1. your result looks like resolution tree

      used for recursive resolution/frequency information scaling and feature extraction not FFT !!! So may be your recursion is wrong or you overlap data (to code in-place FFT is almost insanity) you should start with 1D transform and then use that for 2D and visually check every stage (also the inverse transform to match original data)

    2. your FFT output should have non zero Imaginary part !!!

      look here How to compute Discrete Fourier Transform and into all sub-links in that answer of mine

    3. is your image resolution exact power of 2?

      if not zero pad it or the FFT would not work properly

    4. your example is wrong

      this is how it looks like in real:

      • left is input image (copied from your question)
      • middle is real part
      • right is imaginary part

      you can combine them to power spectrum =sqrt(Re*Re+Im*Im) the Re and Im image is amplified to be seen else just few white dots in the corners would be visible. Here some more examples:

      your expected result looks like shifted by half of the image resolution (so the center of symmetry is in center of image instead of in corners)

    [Edit1] power and wrap

    have added power and wrap functions to mine app so here is the result:

    first the power is computed so intensity=sqrt(Re^2+Im^2) and then wrap is done by shifting image by half size right and down. What is overlapping that comes from the other side back so just swap all points in all lines swap((x,y),(x+xs/2,y)) and then the same for all columns swap((x,y),(x,y+ys/2)). Now the result matches the one from OP the app is here

    这篇关于FFT图像转换的输入和输出应该是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆