1
$\begingroup$

My initial image is a medical image and my main objective is finding directionality. The original size of my image was 8X8 and I have rescaled the image to 32X32 to increase my accuracy. My input image is Fourier Transform Power Spectrum and my main objective is finding directionality. I want to window my image of size 32X32 as an image pre-processing approach. I want to implement the circularly symmetric window in Java. My main concern is that which window should I use and how can I implement? I tried to use the Gaussian window for my image. But, as I apply the Gaussian window, the whole meaning of my image changes. Am I doing something wrong?

Original Fourier Transform Power Spectrum and rescaled images

I have implemented my Gaussian Window in Java as:

    double value = 0;
    double distance = 0;
    double x_center = (imageWidth - 1) * 0.5;
    double y_center = (imageHeight - 1) * 0.5;
    double cutoff = 2;
    double dc_level = 255;
    for (int i = 0; i < image.getWidth(); i++) {
        for (int j = 0; j < image.getHeight(); j++) {
            distance = Math.sqrt(Math.pow(Math.abs(i - x_center), 2)
                    + Math.pow(Math.abs(j - y_center), 2));
            value = dc_level * Math.exp(-1 * distance * distance)
                    / (1.442695 * cutoff * cutoff);
            powerspectrum[i][j] = (int) value;
        }
    }

Thank you so much for your help.

$\endgroup$
6
  • $\begingroup$ What specifically do you hope to gain by windowing? Unless you're transforming the image to the frequency domain (or other post-processing), there is very little reason to window images. As you say, the whole "meaning" of the image changes. $\endgroup$
    – Peter K.
    Commented Sep 24, 2015 at 22:03
  • $\begingroup$ @PeterK. Sorry for confusion,I am working on extremely low resolution images and size of my ROI is 8X8 and I have added some edits to my question. Hope it helps. $\endgroup$ Commented Sep 24, 2015 at 22:38
  • 2
    $\begingroup$ To zero-pad, add zeros around the image, not between the pixels (interleaving). Windowing is meaningful if your image is cropped from a larger image, as in taking a limited angle photo of a larger scene. $\endgroup$ Commented Sep 25, 2015 at 5:43
  • $\begingroup$ @OlliNiemitalo So I will not be using the subtracting mean and windowing but how can I increase my accuracy and be sure of my results. Thanks a lot. $\endgroup$ Commented Sep 28, 2015 at 15:38
  • $\begingroup$ What medical data is this actually? I might be more confident to comment knowing that. $\endgroup$ Commented Sep 28, 2015 at 20:20

1 Answer 1

1
$\begingroup$

Consider the large image, and the region of interest (red):

Large image

If you will simply take the Fourier transform of the 8x8 region, the transform is assuming that the image is periodic like this:

Periodic transform

The Fourier transform will see artificial directional features across the replicates of the 8x8 region. But if you pad the 8x8 image with zeros to 32x32, these artifacts disappear and the frequency resolution of the discrete Fourier transform is enhanced as a welcome side effect as well:

After zero-padding

However, now a new problem is revealed: There are artificial directional features along the boundary lines of the 8x8 region, like in the upper half of the left boundary and in the left half of the upper boundary. A solution is to multiply the 8x8 image with a circularly symmetric window function:

After windowing

The drawback is that the corners of the image are completely ignored. If you think it is useful, you could extend your region of interest so that you would not null the corners of that 8x8 region.

To test the performance of your dominant direction finding algorithm starting with the 8x8 input image, you can use test images. Start with a flat white 8x8 image. This should not give a dominant direction stronger than some level of approximation error. If it does, make sure that your window function has circular symmetry and that you have normalized fairly the calculation of all direction-specific integrals over the squared magnitude of the Fourier transform. Then try 8x8 images with directionality generated by setting the pixels to values $\cos(ax + by + c)$, where $\text{atan2}(a, b)$ defines the directionality, $x$ and $y$ are the pixel coordinates and $c$ should not affect the analysis result.

If your algorithm passes these tests it should be fine!

$\endgroup$
1
  • $\begingroup$ Your explanation is really helpful. Even though I am still confused regarding the application of filter as my image is really small. $\endgroup$ Commented Oct 5, 2015 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.