A6: Properties of the 2D Fourier Transform

After demonstrating the different uses of the 2D Fourier Transform in Activity 5, we now look into the linear transform's properties.

2D Patterns
The 128px by 128px images in Figure 1 (top) were generated using GIMP. All shapes were centered and the slit and dot pairs were made symmetric about the center. FFTs were calculated as in Activity 5:

img = imread('ImageDirectory\ImageFilename.jpg'); //import image
grayimg = im2gray(img); //convert to grayscale
FFTimg = fft2(grayimg); //get FFT
imshow(abs(FFTimg),[]); //view FFT modulus




Figure 1. Left to right: 2D patterns (top) 80px square, annulus (outer and inner radii: 80px and 40px), square annulus (outer and inner side length: 80px and 40px), x-symmetric vertical slits, and x-symmetric dots with respective FFTs (bottom).

Anamorphic
The sinusoid patterns in Figure 2 (top) were generated in Scilab:
nx = 100; //set length of pattern along x
ny = 100; //set length of pattern along y
x = linspace(-1,1,nx); //generate nx x values from -1 to 1
y = linspace(-1,1,ny); //generate ny y values from -1 to 1
[X,Y] = ndgrid(x,y); //tile generated x and y values
f = 4; //frequency
img = sin(2*%pi*f*X); //sine with frequency f




Figure 2. Left to right: sinusoid patterns (top) with frequency values of 2, 4, 6, 8, and 10 with respective FFTs (bottom). We observe an increase in peak/dot distance with increasing frequency.


Figure 3. Left to right: FFTs of sinusoid patterns with a bias of 0.5 with frequency values of 2, 4, 6, 8, and 10 with respective FFTs. We note the appearance of a peak/dot in between the peaks that represent the frequency of the input pattern. This is similar to what you would see in a double-slit experiment interferogram. To find the actual frequency, we remove the bias by removing this peak. Increase in peak distance with frequency is still observed.

For the rotated sinusoids in Figure 4:
theta = 30; //angle
img2 = sin(2*%pi*f*(Y*sin(theta) + X*cos(theta))); //rotated sine




Figure 4. Left to right: sinusoid patterns (top) rotated by 30, 45, and 60 degrees with respective FFTs (bottom). As expected, the FFT peaks rotate with the pattern or the direction at which the sinusoid is running.

For the combined sinusoids in Figure 5:
img = img.*sin(2*%pi*f*Y).*sin(2*%pi*8*X).*sin(2*%pi*8*Y); //sines combined



Figure 5. Left to right: sinusoid patterns with f=4 running in the x-direction (top) combined with one with f=4 running in the y-direction, combined with one with f=4 running in the y-direction and one with f=8 running in the x-direction, and combined with one with f=4 running in the y-direction, one with f=8 running in the x-direction, and one with f=8 running in the y-direction with respective FFTs (bottom).

For the sum of sinusoids in Figure 6:
img = img + sin(2*%pi*f*(Y*sin(theta) + X*cos(theta))); //sum of sines


Figure 6. Left to right: FFTs of sinusoid patterns created from the sum of the combined pattern from Figure 5 (rightmost) and a sinusoid running along the x-direction, a sinusoid running along the x-direction and one rotated by 45 degrees, and a sinusoid running along the x-direction, one rotated by 45 degrees, and another by 60 degrees. We see that the resulting FFTs are just superpositions of the FFTs of the sinusoids added. This is expected since the FFT is a linear transform hence the FFT of the sum of functions result to the sum of the FFTs of the functions.

I give myself a grade of 9 because the required FFTs were correctly generated.

I would like to thank Mr. Luis Buño III, Mr. Orly Tarun and Mr. Jay Samuel Combinido for useful discussions and Mr. Miguel Sison for pointing out errors in the sinusoid images*.

*imwrite, the function I used in saving images requires that image/matrix values be between 0 and 1.

0 comments:

Post a Comment