Assignment4 40168195
Assignment4 40168195
Assignment 4
• The first step to do on that Polka-dot binary image is to detect the edges in that image.
• Now, as the edges are detected, the solid circles will be converted to the circular rings in the
edge image. Thereafter, we can perform the Circle Hough Transform on that image.
• In the image given above, there are circles with 2 different radii. The smaller one and the bigger
one with the radius known to us.
• Here, we have an unknown number of circles present in the image so we will have to start with
finding one circle in order to obtain the threshold value which will represent the centroid of a
all the circles that will be reflected in the Hough Space to identify one circle, i.e., all the points
of that one circle in the original image of radius r in the Hough space where all those circles
will intersect at a single point (a, b) in that space which represents the center of the original
circle.
• When we find the number of intersecting points in the Hough space at that point, it will be
considered as the highest Hough Score of that image. Using this score, we can set the threshold
of the image.
• If the found circle is correct, we will gradually reduce that threshold until the centers of circles
in that image are as per the geometry in the original image. We must do this because there can
be multiple intersections of the circles which might not be the center of circles in the original
image but it is still present in the Hough space.
• We must specify the maximum number of circles we want to find in the image as there can be
many intersecting points in the Hough Space which might or might not determine the center
of the circle in the original image as explained above.
• Thus, if there are let us say 10 circles in the original image, and we specify that the max number
of circles we want to find is 5, then it will select the first 5 circles with the highest Hough score
in the Hough space considering the threshold value set. Similarly, if there are 10 circles in the
image and we specify the max number of circles as 15, it will surely count the real 10 circles
present in the image but it will also try to consider the points which do not really represent the
circle in the original image but still as they have intersecting points in the space.
• So, in this case, the option of setting a perfect threshold value to avoid fake centers can be a
good practice. This can be achieved earlier by detecting only one image and setting the
threshold value as high as possible to avoid the fake intersection of Hough circles.
• In this way, we can set the max number of circles to find as infinite, and thus we can get the
number of circles present in the image as an exact number considering the radius of the circle,
the threshold of the points intersecting in Hough Space, and the area in the image where we
can detect a circle.
Part II: Programming Questions
Question 1: Download the image (tools_noisy.png) from the course webpage. This image
contains noise.
image = imread(“tools_noisy.png”);
gray = graythresh(image);
binary = imbinarize(image, gray);
imshow(binary);
b) Smooth the image by a 5 by 5 averaging filter, then apply Otsu’s algorithm and show the
result. Compare the results in a) and b).
image = imread(“tools_noisy.png”);
filter = fspecial(“average”, 5);
blur_image = imfilter(image, filter);
gray = graythresh(blur_image);
binary = imbinarize(blur_image, gray);
imshow(binary);
imshow(blur_image);
Comparison:
• If we do not apply blurring in the image and if we do the Otsu’s algorithm, the image obtained
in the Figure 1 will be full of noise as it will consider the noise dots also for making the image
binary.
• Thus, before applying the Otsu’s Algorithm on the original image, the image was first blurred
out which removed the noise from the image and due to that, the binary image obtained by the
Otsu’s Algorithm was noise free and clear partitions of the objects in the image was observed.
• However, at some points we can observe that the algorithm is not able to clearly identify the
difference between the objects and the background thus in this area the partition is not perfect.
Question 2: Download the image lena.tif from the course webpage, then do the following with
the MATLAB function, wavedec2():
a) Perform wavelet transform of the Lena image up to and including level 3 by using Haar
wavelet, and show your results.
image=imread("lena.tif");
subplot(2,2,1)
imshow(uint8(approx))
title('HAAR WAVELET Level 3 Approximation')
subplot(2,2,2)
imshow(uint8(hImage))
title('HAAR WAVELET Level 3 Horizontal Coefficient')
subplot(2,2,3)
imshow(uint8(vImage))
title('HAAR WAVELET Level 3 Vertical Coefficient')
subplot(2,2,4)
imshow(uint8(dImage))
title('HAAR WAVELET Level 3 Diagonal Coefficient')
subplot(2,2,1)
imshow(uint8(approx))
title('DAUBECHIES-4 WAVELET Level 3 Approximation')
subplot(2,2,2)
imshow(uint8(hImage))
title('DAUBECHIES-4 WAVELET Level 3 Horizontal Coefficient')
subplot(2,2,3)
imshow(uint8(vImage))
title('DAUBECHIES-4 WAVELET Level 3 Vertical Coefficient')
subplot(2,2,4)
imshow(uint8(dImage))
title('DAUBECHIES-4 WAVELET Level 3 Diagonal Coefficient')
c) Visually compare the quality of the approximation images at level 3 of the two cases and give
your comments.
Figure 6 Comparison between Haar Wavelet and Daubechies-4 Wavelet
As we can see that the Daubechies-4 wavelet is able to detect edges more accurately compared to
Haar wavelet. As the window size of Daubechies-4 wavelet transform is smaller, the edges are
more efficiently detected and thus, it is also able to detect major frequency change in the image
compared to Haar wavelet.