Digital Image Processing Assignment 1
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
Digital Image Processing
Assignment 1
1 Intensity Transformation (40pts)
a) (10pts) Do you think this is a good image or not? Explain why. According to what you have learned in intensity transformation, please propose two solutions to enhance this image (image included in ./code data/test1.png).
Please use the provided skeleton code (”./code data/assignment1 1.py”) for the following questions. You need to write code in specific positions.
b) (10pts) Please refer to the histogram of this image (Line 30 and refer to Line 11 - 20), and describe it in your report.
c) (10pts) Call the function (“cv2.equalizeHist()”) in opencv to realize histogram equa- lization and provide the histogram and image after histogram equalization in your report.
(You may need to refer: https://docs.opencv.org/3.4/d5/daf/tutorial py histogram equalization.html.)
d) (15pts) Please write your own code for histogram equalization (Line 55, 66, 70) and apply your own code to process the image and include the results in your report.
e) (15pts) Analyze the differences before and after histogram equalization.
2 Image Interpolation (30pts)
a) (15pts) Compare the nearest interpolation and bilinear interpolation and briefly des- cribe their advantages and disadvantages.
b) (25pts) Please use provided skeleton code (./code data/assigment1 2.py) to imple- ment bilinear interpolation (Line 36, 37, 38) and use it to resize an image to size 200 ×200. As shown in the figure below, P is the target point in the source image and Q11 , Q12 , Q21 and Q22 are the corresponding nearest points in the source image. Please use these four nearest points to calculate the target point P. (Referring to the provided code, P is (src_x, src_y), Q11 is (src_x_1, src_y_1), Q12 is (src_x_1, src_y_2), Q21 is (src_x_2, src_y_1) and Q22 is (src_x_2, src_y_2))
Note: we have provided the code skeleton in assignment1 2.py
3 Spatial Filtering and Image Sharpening (30pts)
a) (10pts) Refer to the slide Topic 3: Spatial Filtering from Page 36 to 56. Given an image with size M × N and a filter kernel with size m × n, please briefly describe the process of linear spatial filtering using convolution, and show how many multiplication operations need to be performed? If the kernel is separable, how much speed boost can be obtained (considering multiplication calculations only)?
b) (20pts) Please use the provided skeleton code (./code data/assigment1 3.py) to con- duct image sharpening, using function Laplacian from OpenCV, which sharpens the edges of the image. Moreover, conduct the code with different values of magnifying factor and parameters in Laplacian Function, and analyze the results.
Note: we have provided the code skeleton in assignment1 3.py
2025-10-29