EN161 Image Understanding
Assignment 5: Edge Detection

Due : Fri., Oct. 28

 
Notes

Here are a couple of important things you should keep in mind when submitting your solutions for the next MATLAB assignment.

  • You should prepare a lab report. It is not sufficient to send the MATLAB source code. Do not forget to include the report file in the compressed folder that you send. Any globally accepted file format is OK (.doc, .pdf or .ps). Also you should submit a hard copy of your report. You may either hand it to Prof. Cooper in class or leave it on my desk at B&H 309.
     
  • The reports should include:
    • important technical details (names of functions and .m file's you created or you use, how to run your source code)
    • explanation of your algorithm
    • answers for the conceptual questions in the problem
    • you don't need to copy-paste the source code to the Lab report, but if you think some specific lines of code are important to your application, you might include them in your report.
 

 

 

 

 

 

 

 

Edge Detection
For this experiment you will use the images below.
 

ImageA
 

ImageB

 

 

 

Problem 1: 

Give a few examples of each of these types of edges in the images A and B.

  • Occlusion Edges
  • Reflectance Edges
  • Texture Edges
  • Highlight Edges
  • Shadow Edge

for example:

 

Problem 2: 

Run matlabs edge (you can get more information by typing "help edge" in MATLAB console) detection function over Image A and Image B. 

Use:

  • Canny
  • Sobel
  • Laplacian of Gaussian (LoG)
THRESH, SIGMA
THRESH, DIRECTION
THRESH, SIGMA

on ImageA and ImageB. 

  • Determine the strengths and weaknesses of one relative to the other. (Specifically look for the success of each algorithm with respect to corners, curved edges, noise inclusion/exclusion, etc.)
  • Which of the edge types above are most easily detected; which are more difficult. Provide specific examples and images to illustrate your findings.
  • For each of the above methods, parameters that you can change are specified (e.g. for Canny you can specify the sensitivity threshold and the standart deviation for the filter). For each method, obtain results for different parameters. Comment on the effects of each parameter on the edge detection algorithm.

 

Problem 3: 

In this problem you will explore a very simple edge detector on ImageA and ImageB.

a. Load the image and smooth it with a Gaussian filter to eliminate noise. Discuss how you choose the sigma in the Gaussian filter.
b. Use the gradient function (you can get more information by typing "help gradient" in MATLAB console) on the preceding smoothed output to compute the 1st derivatives in the x and y direction:

[dy,dx]=gradient(A);

c. Look at the magnitude of the gradient image using imshow (M=sqrt(dx^2+dy^2))
d. Now use the quiver function (you can get more information by typing "help quiver" in MATLAB console) to view the actual gradient vectors; you may want to zoom in.  (The image will be upside down, don't worry about it).

quiver(dy,dx);

e. Create a binary edge image by thresholding the gradient magnitude image.  You can use your own choice of method to select the threshold (e.g. by looking at the magnitude histogram and perhaps some local measurements of noise in the images to determine an appropriate threshold).

f. Finally thin the edges using the following process:

   1.  Visit every edge pixel in the binary image.  For each one, look at the gradient direction at that point (dy,dx) and round it to the nearest of the 8 pixel directions.
   2.  Look at the gradient magnitude of the pixel in that direction and also at the pixel in the oposite direction.
   3.  If the pixel in question has a gradient magnitude less than either of those two neighbors, set its value in the binary image to 0.

Submit the thinned and unthinned images.