I am trying to obtain 2D FFT of an image. From the 2D FFT, I wish to calculate the amplitude of the FFT averaged over a circle vs the distance in pixels by varying the radius of the pixels which is effectively the distance in pixels.
The FFT of the original image is obtained by the following code. The scale bar for the original image is roughly like this: Distance in pixels = 4 Distance in scale = 1 micrometer.
Code to evaluate 2D FFT:
data = Binarize[Dilation[image, 1]]
Dimensions[ImageData[data]]; //this step is just for checking purposes
Imgdata = ImageData[data]
Since I have already binarized the image, the dimension of the image will be of the form M X N The main steps for the Fourier Transform:
FWData = Imgdata
FWData = FWData*(-1)^Table[i + j, {i, IRow}, {j, ICol}]
fw = Fourier[FWData, FourierParameters -> {1, -1}]
Magnification Factor is just for adjusting the intensity of the FFT image which I have observed in some cases is too light
MagnificationFactor = 1
abs = MagnificationFactor*Log[1 + Abs@fw]
Image[abs/Max[abs]]
Finally, I arive at the following image giving the 2D FFT amplitude spectrum.
Black = 0 and white = 1
Now what I have to do is to plot the amplitude of the FFT averaged over circles with respect to distance in pixels.I wanted to find the centre of the image and then assume a circle with a certain radius and average the FFT amplitude over that radius and continue by changing the radius.
Once, we get the plot we can change the distance in pixels to the real world distance using the scale bar.
Any help will be highly appreciated.
Comments
Post a Comment