Answered step by step
Verified Expert Solution
Question
1 Approved Answer
[ Question 6 ] Edge Detection ( 5 0 marks ) In this question, the goal is to implement a rudimentary edge detection process that
Question Edge Detection marks
In this question, the goal is to implement a rudimentary edge detection process that uses a derivative of Gaussian, through a series of steps. For each step excluding step you are supposed to test your implementation on the provided image, and also on one image of your own choice. Include the results in your report.
Step I Gaussian Blurring marks: Implement a function that returns a D Gaus sian matrix for input size and scale sigma Please note that you should not use any of the existing libraries to create the filter, eg cvgetGaussianKernel Moreover, visualize this D Gaussian matrix for two choices of sigma with appropriate filter sizes. For the visualization,
you may consider a D image with a colormap, or a D graph. Make sure to include the color bar or axis values.
Step II Gradient Magnitude marks: In the lectures, we discussed how partial derivatives of an image are computed. We know that the edges in an image are from the sudden changes of intensity and one way to capture that sudden change is to calculate the gradient magnitude at each pixel. The edge strength or gradient magnitude is defined as:
gxyfxyqgxgy
where gx and gy are the gradients of image fxy along x and yaxis direction respectively.
Using the Sobel operator, gx and gy can be computed as:
gxfxyandgyfxy
Implement a function that receives an image f x y as input and returns its gradient gx y magnitude as output using the Sobel operator. You are supposed to implement the convolu tion required for this task from scratch, without using any existing libraries.
Step III Threshold Algorithm marks: After finding the image gradient, the next step is to automatically find a threshold value so that edges can be determined. One algorithm to automatically determine imagedependent threshold is as follows:
Let the initial threshold tau be equal to the average intensity of gradient image gx y
as defined below:
Phj Pwi gi jtau htimes w
where h and w are the height and width of the image under consideration.
Set iteration index i and categorize the pixels into two classes, where the lower class consists of the pixels whose gradient magnitudes are less than tau and the upper class contains the rest of the pixels.
Compute the average gradient magnitudes mL and mH of lower and upper classes, respectively.
Set iteration i i and update threshold value as: tau i mL mH
Repeat steps to until tau i tau iepsi is satisfied, where epsi ; take tau i as final threshold and denote it by tau
Once the final threshold is obtained, each pixel of gradient image gx y is compared with tau The pixels with a gradient higher than tau are considered as edge point and is represented as white pixel; otherwise, it is designated as black. The edgemapped image Ex y thus obtained is:
if gx ytau otherwise
Implement the aforementioned threshold algorithm. The input to this algorithm is the gra dient image gx y obtained from step II and the output is a black and white edgemapped image Ex y
Step IV Test marks: Use the image provided along with this assignment, and also one image of your choice to test all the previous steps I to III and to visualize your results in the report. Convert the images to grayscale first. Please note that the input to each step is the output of the previous step. In a brief paragraph, discuss how the algorithm works for these two examples and highlight its strengths andor its weaknesses.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started