DOC PREVIEW
UCSD CSE 152 - Assignment 2

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CSE 152 - Introduction to Computer VisionAssignment 2Due Thursday, May 6Reading. Trucco and Verri: Chapter 3 (pg 51-65), Chapter 4 (pg 67 -81),Chapter 5 (pg 97-101), Appendix A2 (pg 311-313).Question 1 (5 pts.) Let A be the data array A = [1 1 2 0 1 11 10 9 11 9].1 2 3 4 5 6 7 8 9 10024681012Figure 1: Array A1. Compute the convolution of A and B = [1 1 1]. Plot your result.2. A first derivative of A is DA[i] = (A[i + 1] − A[i − 1])/2 for i = 1..8.Compute DAand plot your result.3. Now find the convolution of A and G = [0.5 0 − 0.5]. Compare withthe result in part 2.Question 2 (20 pts) Implement the Canny edge detector with the followingsteps.1. Write a function that takes as input two arguments (an image, anda number sigma) and returns an image. The function should smooththe input image with a Gaussian filter with standard deviation sigma.Your filter size should be 2*(round(3*sigma))+1 by 2*(round(3*sigma))+1.Note that you can make this faster by taking advantage of seperabil-ity (Matlab hint: fspecial, conv2 or filter).12. Compute the gradient in each dimension. (Matlab hint: gradient).3. Estimate the edge strength and edge orientation. Quantize the edgeorientation with 4 directions (ie 00, 450, 900and 1350). (Matlab hintatan2)4. Apply nonmaximum suppression to thin the edges to 1-pixel wide.5. Starting with a local mazimum, apply hysteresis thresholding usingtwo tresholds to produce a set of linked edgels.Test your algorithm with ’floppy.bmp’ and ’corridor.bmp’. For ’floppy.bmp’,show all intermediate results (i.e smoothed image for sigma=1, two gradi-ent images Jxand Jy, edge strength, detected edges after nonmaximum-suppression, and the final result). For the final step, experiment withdifferent thresholds until you get what looks like good results.For ’corridor.bmp’, show the final result only. You may choose differenttresholds for this image.Question 3 (15 pts) Implement the Hough transform for detecting lines. Useyour result for ’floppy.bmp’ from the question 2 above or use ’floppy edge.bmp’as test image.1. Run A = zero(175,180) to create an array of size 175x180. Thiswill be the accumulator for your Hough transform algorithm.2. For each non-zero pixel (i, j) in the test image, and for θ = 1...180,compute ρ = i cos(θ ∗ π/180) + j sin(θ ∗ π/180). Increment A(ρ, θ) byone. Show the accumulator as an image (simply use ’imshow(A)’)3. Threshold A and find the 4 largest local maxima Show the param-eters (ρ and θ) for each of these lines.4. Draw those 4 lines (use a light color and linewidth at least 3) on topof your input image. The following code snippet shows how to drawa line and save the figure:imshow(img); %display image as usualhold; %hold the figure to draw line%draw a red line from point (0,0) to (100,50).line([0 100],[0,50],’color’,’r’);%draw an yellow line from (x(1),y(1)) to (x(2),y(2)) and width = 3.line(x,y,’color’,’y’,’linewidth’,3);%save the current figure to jpeg file.print(’-djpeg’,’save.jpg’);2What to hand in:1. Written answer with figures for Question 1.2. Result images for Question 2. (note: six images for ’floppy.bmp’ and onefor ’corridor.bmp’)3. The accumulator image for Question 3.4. Parameters of the top four lines and the image with those lines superim-posed for Question 3.5. Turn in hard copy during class on Thurday, May 6.6. Submit source code using ’turnin’ no later than 23:59:59, May 6. Forinstruction, see the class web


View Full Document

UCSD CSE 152 - Assignment 2

Download Assignment 2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Assignment 2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Assignment 2 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?