Starting from:

$30

DIP-Homework 4 Solved

Problem 1: DIGITAL HALFTONING
sample1.png is given in Figure 1.(a) Please apply several halftoning methods to the given image and provide discussions about the detail of the results.

(a)  Perform dithering using the dither matrix I2 in Figure 1.(b) and output the result as result1.png.

(b)   Expand the dither matrix I2 to I256 (256 × 256) and use it to perform dithering. Output the result as result2.png. Compare result1.png and result2.png along with some discussions.

(c)  Perform error diffusion with two different filter masks. Output the results as result3.png, and result4.png, respectively. Discuss these two masks based on the results. You can find some masks here (from lecture slide 06. p23)

(d) Try to transfer result1.png to a dotted halftone / manga style binary image such as sample1  dotted.png in Figure 1.(c). Describe the steps in detail and show the result. You may need to utilize a function like cv2.circle to draw a circle.

1
2
3
0
 (a) sample1.png                                  

 (b) Dither Matrix I2                                            

(c) sample1 dotted.png

Figure 1: The image and dither matrix for digital halftoning.

Problem 2: FREQUENCY DOMAIN
In this problem, please perform Fourier transform and observe the relation between the spatial domain and the frequency spectrum. You may adopt tools for Fourier transform. The recommended tools are listed in the Appendix.

(a) Perform Fourier transform on sample2.png to obtain its frequency spectrum and output it as result5.png. (Please take the log magnitude of the absolute value and center the low frequency part at the origin for visualization.)

(b) Based on the result of part (a), design and apply a low-pass filter in the frequency domain and transform the result back to the pixel domain by inverse Fourier transform. The resultant image is saved as result6.png. Please also design a low-pass filter in the pixel domain which behaves similarly to the one you design in the frequency domain. Output the result as result7.png and provide some discussions.

(c)   Based on the result of part (a), design and apply a high-pass filter in the frequency domain and transform the result back to the pixel domain by inverse Fourier transform. The resultant image is saved as result8.png. Please also design a high-pass filter in the pixel domain which behaves similarly to the one you design in the frequency domain. Output the result as result9.png and provide some discussions.

(d) Perform Fourier Transform on sample3.png and output it as result10.png. Please discuss what you observe in sample3.png and result10.png.

(e)  Try to remove the undesired pattern on sample3.png and output it as result11.png.
 (

a) sample2.png                                                                    

(b) sample3.png

Figure 2: Images for Fourier transform.

Appendix
Problem 1: DIGITAL HALFTONING sample1.png:    256 × 256             gray-scale

Problem 2: FREQUENCY DOMAIN

sample2.png:
480 × 640
gray-scale
sample3.png:
480 × 640
gray-scale
Recommended tools for Fourier transform

scipy.fftpack.fft2 scipy.fftpack.ifft2 scipy.fftpack.fftshift scipy.fftpack.ifftshift numpy.fft.fft2 numpy.fft.ifft2 numpy.fft.fftshift numpy.fft.ifftshift

More products