Question: .Write a simple edge detector based on the Canny edge detector: 1. Image Smoothing (5 points) Write/use a Matlab, function that will smooth an
.Write a simple edge detector based on the Canny edge detector: 1. Image Smoothing (5 points) Write/use a Matlab, function that will smooth an image with a Gaussian filter. The function should take as input an image and a value for sigma that will be used to smooth the image. You may use the function special to create the Gaussian filter and the function infilter to perform correlation with it. You should be sure that the width of your filter is at least two * sigma + 1, to fully capture the Gaussian. For example, if sigma is 2, you might use a filter that has a size of 5x5 (2*2+1). For sigma = 4, you might use a filter size of 9x9 (2*4+1). 2. Gradient Image (5 points) Next, write/use a function that will compute the gradient of an image. Your function should take an image as input and return two images. Each image will be the size of the original image. One will contain the x component of the image gradient for each pixel, the other will contain the y component of the gradient. Hint: you will need to do padding of your original image in order to keep the same size. 3. Magnitude and direction of the gradient (5 points) Next, write a function to compute the magnitude and direction (as described by the two components of the gradient, not the angle) of the gradient. This function should take as input the two images produced by the previous function, which contain the x and y components of the gradient. It should return three images, which contain the magnitude of the gradient at each pixel, and the x and y components of the gradient direction. 4. Edge Pixels (5 points) Finally, combine these functions together to create a function that will find positions in the image in which the gradient is a local maxima, and "reasonably" large. This function will take three inputs: an image, sigma, and t. We will only detect edges at pixels in which the magnitude of the gradient is greater than this threshold t. The output of this function will be a binary matrix. For every pixel, there will be a I if there is an edge at that pixel, and a zero if there is no edge. CSC482 (5 points): Add hysteresis to your edge detector. It should take two thresholds as input, along with the image and sigma. A pixel is an edge if the gradient magnitude is greater than the first threshold, but also if the gradient magnitude is bigger than the second threshold and it has a neighbor that is an edge (note that this is a recursive definition). Hint: It will be a good idea to turn your image into a matrix of floating point numbers using the double function. If not, you will get into trouble, because images are constrained to be non-negative integers below 255. If, for example, the gradient is sometimes negative, it cannot be stored in an unsigned integer image. Run your code on an image from a particular domain (best if you use grayscale or convert to color to grayscale) and save the results of parts # 1, 2, 3, 4 for the chosen image. For each point, explain the output images and what values for the parameter you chose in order to get the corresponding output. For example, for part #1 explain what value you chose for sigma and why. Also show different results by varying the values of the parameters. CSC482 (5 points): Use a color image and don't convert to grayscale. You still need to ultimately output a binary image with edge locations marked. To answer this question, you will need to decide what a color edge is. You do not need to find the "right" answer (there isn't one). You may convert to any color space you like, but you must consider all channels. (E.g., conversing to HSV and only using V does not satisfy the requirements of this part of the assignment.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
