I have applied Fourier Transform to the following image.

enter image description here

I have downloaded this image from the Internet. I re-sized (without maintaining the aspect ratio) it using MS Paint application of Win7 to make it 512x256.

Then I have used two applications to observe its Fourier Transformed appearance.

IPLab gives the following output:

enter image description here

ImageJ2-20160205 gives the following output:

enter image description here

As you can see, the first output is a 512x256 image. The second one is a 512x512 image.

Why are those outputs different?

How would they effect processing of an image?

  • 1
    $\begingroup$ Without seeing the details of the transform, I would assume the second case is zero-padded out to the 512 dimension. If this is the case, this will result in interpolated samples to the original image when you do the IFFT; so a form of upsampling. Have you tried to take the IFFT of the second image using IPLab? $\endgroup$ – Dan Boschen Jul 14 '16 at 12:25
  • $\begingroup$ @dan boschen, not yet. But, now I would. $\endgroup$ – user18425 Jul 14 '16 at 13:10
  • $\begingroup$ @laurent duval, hmm.. What does that indicate? $\endgroup$ – user18425 Jul 14 '16 at 13:38
  • 1
    $\begingroup$ That this is is not the size that only matters:) You have coloured images. Try redo on their grayscale version $\endgroup$ – Laurent Duval Jul 14 '16 at 13:43

Looking at the source code for ImageJ I see:

public void run(ImageProcessor ip) {
    boolean inverse;
    if (!powerOf2Size(ip)) {
        IJ.error("A square, power of two size image or selection\n(128x128, 256x256, etc.) is required.");
    ImageProcessor fht  = (ImageProcessor)imp.getProperty("FHT");
    if (fht!=null) {
        ip = fht;
        inverse = true;
    } else
        inverse = false;
    ImageProcessor ip2 = ip.crop();
    if (!(ip2 instanceof FloatProcessor)) {
        ImagePlus imp2 = new ImagePlus("", ip2);
        new ImageConverter(imp2).convertToGray32();
        ip2 = imp2.getProcessor();
    fft(ip2, inverse);

which suggests that some parts of the code expect a) the image size to be a power of 2 and b) that the image is square. Perhaps some part of the code you are using is enforcing this?

| improve this answer | |

Here is a third different output. So I have tried to perform an FFT with Matlab, on four versions of your image:

  • the grayscale version of the colored image,
  • the red, green, and blue channels.

I do get the following, with $512\times256$ size, in a $\log$ scale.

Fourier Grayscale RGB

If as suggested by @Peter K. you zero-pad below, with $512\times512$ size, one gets:

Fourier Grayscale RGB padded

Looks like the FFT of the Red component, padded. If you have the opportunity to do other tests, we can settle this riddle

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy