Tuesday, June 21, 2011

II

Today, we tinker with the basics of image processing using SciLab and its modules. From the sample code snippet included in the A2 pdf file, I've plotted a circular aperture. It seems that 1=white and 0=black in pixel color.

 
 Figure 1. Example code and the circular aperture image it produces 

  Employing matrix subtraction, I have modified the example code to achieve the annulus.
 

 Figure 2. Code and image for the annulus

Next is the sinusoid along the x-direction (corrugated roof) image. I still used the layout of the example code for this. Now instead of generating A as a zero matrix, I have used the sine function to form a grayscale image.

Figure 3. Code and image for the corrugated roof image. Note the constant 5 in the argument of the sine function. (f=2/5)


For the grating along the x-direction image, I've just modified the code in Fig. 3 to have binary values. To facilitate the inhomogeneity due to rounding, I've modified the nx and ny and the frequency of the code.


Figure 4. Code and image for the grating along x-axis

For the circular aperture with Gaussian transparency, I've modified the circular aperture with a normal Gaussian function of r.

Figure 3. Code and image for the circular aperture with Gaussian transparency. Sigma = 0.9 

The last image I produced is the rectangular aperture at the center. To achieve this, I used
the A(xi:xn,yi:yn)=k to set the values of the middle segment of the matrix of width 20 pixels.

Figure 5. Code and image for the square aperture. Side = 20 pixels. 

 Due to time constraints and unfamiliarity with the SciLab, I haven't yet been able to code this in a general, precise and efficient form. I will improve on this.

  Self-Assessment: 10/10   

No comments:

Post a Comment