All programs should be written using MATLAB. Solutions must be consolidated into a single pdf file (including all results and an explanation of results) and a zip file (including all m-files used for the results). Solutions must be submitted electronically through Canvas. Late solutions will be penalized at 10% deduction from the homework score, and will NOT be accepted 24 hours after due date.
1. Pin-hole optics
Consider a dark edge projected through a pinhole. Show that
=A = 1 cos−1 s s Rs 2
− 1−
O R R
where−R s R ; s is the displacement of the pinhole center from
the edge; δO is the pin hole projection area; and δA is portion of δO in the dark area. Plot ρ as a function of s/R. Fig. 1
2. Histogram equalization
Figure 2 shows an 8-bit gray-scale image of an eye-retina.
Fig. 2 eyeball.png
- Perform a histogram equalization of the sub-region shown in image matrix; give your results by completing Table 1. Show the histogram equalized results of sub-region matrix.
| Gray level | # of pixels | cdf | qk | round(qk) |
| 113 | 1 | 1 | 5.31 | 5 |
| ׃
׃ |
׃
׃ |
׃
׃ |
׃
׃ |
׃
׃ |
| 128 | 2 | 48 | 255 | 255 |
Table 1
- Perform histogram equalization on an image by writing a Matlab script for the following:
- Read in and display the image ‘eyeball.png’.
- Compare by displaying the original and processed images and their histograms.
Suggested Matlab functions: imshow, imhist or hist, histeq
- Filtering masks
(a) Show the value of a 5×5 Gaussian filter with equal to 2 pixels.
Sobel operator
- Use a 3×3 Sobel operator to calculate the magnitude and direction of the gradient at pixel (X, Y)=(4, 5) in Fig. 2. Indicate the direction of the gradient on the pixel. (Note: Sobel operator is coordinate dependent. Be sure to use consistent coordinate systems on the sub-regions.)
- Write a Matlab script to compute the gradient of an image. For illustration, use the Sobel operator on the image “IC_pin.png” shown Fig. 3(a). Display the gradient images (Gx, Gy, G). Suggested Matlab functions: edge.m
Gaussian operator and Difference of Gaussian (DOG):
- Use an m×m Gaussian filter mask with different (=1, 2 and 5) to smooth the noisy image shown in Fig. 3(b). Compare the effect of on the smoothed image. Suggested Matlab functions: imfilter.m.
Notes: ‘Smoothing effects are more prominent as sigma increases. Mask size increases as sigma increases.
- Perform DoG operation (with =1 and =2) on Fig. 3(c) and show the processed image.
(a) ‘IC_pin.png’ (b) ‘salt_and_pepper_checker.png’ (c) ‘checker.png’
Fig. 3
4. Low-level information processing
- Read in and convert the image (Fig. 4) into a gray-scale image. Binarize the image using three different thresholds; the “best or preferred” value, and an over-estimate and under-estimate values. (Use image histogram to help pick the threshold values).
- Obtain the area and centroid of the two objects (nut and shelf) in the image with an appropriate threshold.
Suggested Matlab functions: rgb2gray.m, im2bw.m, bwlabel.m, regionprops.m
Figure 4 ‘nut_and_shell.png’
1




