Question 1: Image Sharpening and Filtering
In this task, we ffrst sharpen and fflter the images. First, the original image is loaded using the imread() function. Then, a median fflter is applied to remove the noise. After that, a sharpening fflter is used to enhance the details of the image.
1.1 Method
The sharpening fflter used in this task is a Laplacian kernel, which enhances the edges and details in the image.
This is done by convolving the image with the kernel. The kernel used for sharpening is:
K = −1 −1 −1 −1 9 −1 −1 −1 −1 The median fflter is ffrst applied to the image to remove noise, and then the sharpening fflter is applied to enhance the sharpness and clarity of the image.
1.2 Result After the ffltering and sharpening, the following image is obtained. This is the processed image after applying the median fflter and the sharpening fflter:
Question 2: Blue Tile Detection and Extraction
In the second task, the goal is to extract the second and fourth blue tiles from the image. First, the image is converted to the HSV color space. Then, morphological operations such as dilation and erosion are applied to enhance the blue regions and remove noise. Finally, blue areas are extracted from the image using connected component analysis (contour detection).
2.1 Method
The HSV color space is used because it makes it easier to detect the blue color. The speciffc HSV range for blue tiles is deffned as:
Lower Blue = 100 80 50 , Upper Blue = 140 255 255
A mask is created by applying these thresholds to the image. The mask is then processed using morphological dilation and erosion to remove noise and further enhance the blue areas. Finally, contours are detected, and the second and fourth blue tiles are extracted based on their area.
2.2 Result
The image below shows the blue areas that were extracted through the mask. The mask has been optimized to clearly show the target tile area. Through contour analysis, the second and fourth blue tiles are extracted and displayed.