Test

1
Assignment 1 Implement a modified Canny edge detector: edge enhancement Apply Gaussian smoothing to the image. The kernel size of the Gaussian filter is the first user input. Use any method to compute the gradient of the smoothed image and estimate the magnitude and orientation of the gradient. For each pixel, find the best gradient orientation out of 4 possible directions - 0°, 45°, 90°, and 135° with respect to the horizontal axis. Show the gradient orientation in the following way: 0° - black 45° - dark grey 90° - light grey 135° - white Also, show the gradient magnitude by quantizing to 256 grey levels. non-maximum suppression If the gradient magnitude is smaller than at least one of its two neighbors along the best gradient orientation, change it to zero. Show the non-maximum suppressed gradient magnitude by quantizing to 256 grey levels. hysteresis thresholding The two thresholds τ l and τ h are the second and third user inputs. If the suppressed gradient magnitude is larger than τ h , locate it as an edge pixel. If it is not an edge pixel, check its two neighbors along the perpendicular direction to the best gradient orientation. If they have gradient magnitude larger than τ l , locate them as edge pixels. Continue to examine the whole image to locate all edge pixels. Show the final result – edge pixels as white, non-edge pixels as black. Make sure you have added comments to the source code. If you are not using MATLAB, please also submit the executable file. Include the source code, intermediate results and the final result into a MS Word file. Indicate the setting of your program. Use the test image as provided in CityU Blackboard. Submit the MS Word file by e-mail on or before 2 March 2012 . [10 marks]

Transcript of Test

Page 1: Test

Assignment 1

Implement a modified Canny edge detector:

edge enhancement

Apply Gaussian smoothing to the image. The kernel size of the Gaussian filter is the first

user input. Use any method to compute the gradient of the smoothed image and estimate

the magnitude and orientation of the gradient. For each pixel, find the best gradient

orientation out of 4 possible directions - 0°, 45°, 90°, and 135° with respect to the

horizontal axis. Show the gradient orientation in the following way:

0° - black

45° - dark grey

90° - light grey

135° - white

Also, show the gradient magnitude by quantizing to 256 grey levels.

non-maximum suppression

If the gradient magnitude is smaller than at least one of its two neighbors along the best

gradient orientation, change it to zero. Show the non-maximum suppressed gradient

magnitude by quantizing to 256 grey levels.

hysteresis thresholding

The two thresholds τl and τh are the second and third user inputs. If the suppressed

gradient magnitude is larger than τh, locate it as an edge pixel. If it is not an edge pixel,

check its two neighbors along the perpendicular direction to the best gradient orientation.

If they have gradient magnitude larger than τl, locate them as edge pixels. Continue to

examine the whole image to locate all edge pixels. Show the final result – edge pixels as

white, non-edge pixels as black.

Make sure you have added comments to the source code. If you are not using MATLAB,

please also submit the executable file. Include the source code, intermediate results and

the final result into a MS Word file. Indicate the setting of your program. Use the test

image as provided in CityU Blackboard. Submit the MS Word file by e-mail on or before

2 March 2012.

[10 marks]