Implement and Experiment with Canny Edge Detector
We discussed in class today the Canny edge detector. You can also get the original paper from Canny and from page 71 in the Trucco/Verri book. Implement all steps of the Canny Edge detector, apply it to the images that you found on the web. Play with the parameters. Plot the edge images for each example image. Here is a summary of all steps:
You might find the matlab diaries from class useful for this assignment: (look at top-level class page for latest links)
See Canny Edge Detection example.
Deadline for electronic submission is 5pm Thursday, Oct 14, 2004
2nd Part of this HW: Implement and experiment with "Lucas-Kanade" flow estimation
If you use matlab do following steps:
Step 0 (Initialization):
Label in the first image of your sequence (Image F) the region of interest (ROI). Either pick a center + some rectangular area with imagesc(im); xy = ginput(1) or choose an arbitray ROI shape with imagesc(im); roi = double(roipoly);
In order to get all the indices of the region of interest, you can use inds = find(roi); . For example to sum over all Fx you can do sum(Fx(inds).^2) .
Fx(x,y) is the spatial gradient along the x-axis of image F at location x,y.
Fy(x,y) is the spatial gradient along the y-axis.
You can compute those gradients with the convolution we discussed in class. Pick a sigma (start with 3 for the first few iterations and then 1.5), and compute the convolution kernel. You can create that kernel by computing two vectors: gauss (the gaussian function), and dgauss (the first derivative of the gaussian function). Compute the outer product: kernel = gauss * dgauss' . Here's what I get if I do that for sigma = 2 and plot it in matlab with surf(kernel):
Convoluting an image with this kernel can be done using conv2() in matlab. You compute Fx with kernel=gauss * dgauss', and Fy with kernel=dgauss'*gauss;
Ft (the temporal gradient of the iamge) can be computed in just substracting G-F.
Step 3 (Re-warping). Rewarp G (or F). Remember to rewarp the original image each time. Do not rewarp a rewarped image. The rewarping should be done in sub-pixel accuracy. You can do that with interp2(... ,'cubic'); The XI and YI coordinates (as specified in matlab help) can be computed in the following way: first use meshgrid() and then add to them the new U and V.
Step 4 If error too high, goto Step 1.