Lunes, Hulyo 25, 2011

Activity 7

In this activity, we would observe the properties of the Fourier transform on 2D images. The Fourier Transform of a signal converts it to a spatial frequency distribution of that signal. The Fourier Theorem says that any image or signal can be represented as a superposition of sinusoids.

Familiarization with FT of different 2D patterns

I generated 2D patterns using paint and made used FFT on it using Scilab. I did this to familiarize ourselves with the Fourier Transform of the 2D patterns. The patters generated were a square, annulus, square annulus, two slits along x axis and two dots along x axis. This was done using the code below in Scilab. 




Figure 1. Square generated in Scilab
  Figure 2. Fourier Transform of the Square generated in Scilab  

  Figure 3. Annulus generated in Scilab  
  Figure 2. Fourier Transform of the annulus generated in Scilab    
  Figure 5. Square annulus generated in Scilab  
  Figure 6. Fourier Transform of the square annulus generated in Scilab    
  Figure 7. Vertical slits generated in Scilab  
   
    Figure 8. Fourier Transform of the vertical slits generated in Scilab  

    Figure 9. Symmetric dots generated in Scilab  
    
Figure 10. Fourier Transform of the symmetric generated in Scilab   
Figure 11. Sinusoid generated using Scilab with frequency equal to 2. 


Anamorphic property of the Fourier Transform
               
Fourier Transform has a property in which the frequencies of sinusoids are determined and are plotted along the axis in which the sinusoid propagates. We can see this in the figures below. I generated a sinusoid using Scilab and performed FFT on it. After generating the sinusoid using Scilab, I generated its fourier transform using Scilab using the code above. 



  Figure 12. Fourier Transform of the Sinusoid generated using Scilab with frequency equal to 2.  
  Figure 13. Sinusoid generated using Scilab with frequency equal to 4  
  Figure 14. Fourier Transform of the Sinusoid generated using Scilab with frequency equal to 4.  
  Figure 15. Sinusoid generated using Scilab with frequency equal to 6  
  Figure 16. Fourier Transform of the Sinusoid generated using Scilab with frequency equal to 6.  
  Figure 17. Sinusoid generated using Scilab with frequency equal to 8  
  Figure 18. Fourier Transform of the Sinusoid generated using Scilab with frequency equal to 8.  
Notice in the figure that the FFT of the image is always symmetrical and it follows the direction of propagation of the sinusoid. Looking at figures 11-18, we can see that ncreasing the frequency, increased the spacing between the two ‘peaks’ of the Fourier Transform.
  Figure 19. Sinusoid generated using Scilab with a constant bias  
Figure 20. Fourier Transform of the Sinusoid with a constant bias 
  Figure 21. Two sinusoids propagating in the same direction combined
  Figure 22. Fourier Transform of two sinusoids propagating in the same direction combined  

I tried adding a bias to the sinusoid to see what would happen. Notice that when I put a constant bias on the sinusoid, a new ‘peak’ at the center appears (Figure 20). I also tested for a non-constant bias, in this case another sinusoid. Notice that the peaks are the frequencies of the sinusoids that are superimposed.


Next, we try rotating the sinusoid, to see if the peaks would follow along the direction of propagation. Notice in the figure that it does follows the direction of propagation.
 
Figure 23. The rotated sinusoids and their Fourier transforms. The angles are 45(top), 30(middle) and 15(Bottom).
Figure 24. Sinusoids propagating along the X and Y axis combined by addition
  Figure 25. Fourier Transform of Sinusoids propagating along the X and Y axis combined by addition  
  Figure 26. Sinusoids propagating along the X and Y axis combined by multiplication  
  Figure 27. Fourier Transform of Sinusoids propagating along the X and Y axis combined by multiplication  
  Figure 28. Sinusoids propagating along the X and Y axis combined by bitwise multiplication  
  Figure 29. Fourier Transform of Sinusoids propagating along the X and Y axis combined by bitwise multiplication.  

In this part, I would observe the properties of the combination of sinusoids by addition, multiplication and bitwise multiplication. Notice in figures 24-29 , that when we combined two sinusoids which are perpendicular, the peaks are also perpendicular with each other. Also notice that the output of the matrix multiplication and bitwise multiplication looks similar. 

  Figure 30. Rotated sinusoids at the angle of 30, propagating in the x and y axis combined using addition(top) and its Fourier Transform.    
  
  Figure 31. Rotated sinusoids at the angle of 30, propagating in the x and y axis combined using  multiplication(top) and its Fourier Transform(bottom).    
  Figure 32. Rotated sinusoids at the angle of 30, propagating in the x and y axis combined using bitwise multiplication(top) and its Fourier Transform.    

Next we add a rotated sinusoid to the pattern before.  Notice that if we combine it with a sinusoid with the same frequency and varying angle of propagation, the peaks also rotates and seem to form a circle since the spacing is the same.

 
In this activity, we were able to observe the properties of the Fourier transform on 2D images. Through this activity I was able to garner insight on the Fourier transform of an image and gained knowledge in predicting what may be the Fourier Transform of an image. I would give myself a grade of 9/10 in this activity.



Lunes, Hulyo 18, 2011

Activity 8-Enhancement in the Frequency Domain

Enhancement in the Frequency Domain

Masking the frequencies of the image in the Fourier domain is one way to remove undesired repetitive patterns in an image. This can also be done to improve the quality of an image if the desired frequencies are enhanced. Filter masks are used to be able to do this.


Figure 1. Two Symmetric dots generated using Scilab




  
  Figure 3. Two Symmetric circles with a small radius generated using Scilab  



  Figure 5. Two Symmetric circles with  a medium radius generated using Scilab  


  Figure 7. Two Symmetric circles with  a large radius generated using Scilab  



  Figure 7. Two small symmetric squares generated using Scilab  



    Figure 7. Two medium-sized symmetric squares generated using Scilab  



    Figure 7. Two large symmetric squares generated using Scilab