660 likes | 682 Views
Learn the fundamental concepts of corner detection in computer vision, focusing on recognizing edges, corners, and flat regions by analyzing image intensity changes. Explore the mathematics behind corner detection algorithms and the application of Harris Corner Detector in image processing. Discover how eigenvalues and the Corner Response Function help classify image points. Dive into the Harris Detector Algorithm and its implementation in MATLAB for accurate corner detection in various images.
E N D
Advanced Computer VisionIntroduction Lecture 02 Roger S. Gaborski Roger S. Gaborski
Corner Detection: Basic Idea We should easily recognize the point by looking through a small window Shifting a window in anydirection should give a large change in intensity “flat” region:no change in all directions “edge”:no change along the edge direction “corner”:significant change in all directions Roger S. Gaborski Source: A. Efros
Corner Detection: Mathematics Window function Shifted intensity Intensity Window function w(x,y) = or 1 in window, 0 outside Gaussian Change in appearance for the shift [u,v]: Roger S. Gaborski Source: R. Szeliski
Corner Detection: Mathematics Change in appearance for the shift [u,v]: I(x, y) E(u, v) E(3,2) E(0,0) Roger S. Gaborski Source: R. Szeliski
Corner Detection: Mathematics Change in appearance for the shift [u,v]: We want to find out how this function behaves for small shifts Second-order Taylor expansion of E(u,v) about (0,0) (local quadratic approximation): Roger S. Gaborski Source: R. Szeliski
Corner Detection: Mathematics M The quadratic approximation simplifies to where M is a second moment matrixcomputed from image derivatives: Roger S. Gaborski Source: R. Szeliski
Interpreting the second moment matrix First, consider the axis-aligned case (gradients are either horizontal or vertical) λ1 and λ2 will be proportional to the principal curvature of autocorrelation function. If either eigenvalue λ is close to 0, then this is not a corner, so look for locations where both are large. Roger S. Gaborski
Interpreting the eigenvalues Classification of image points using eigenvalues of M: 2 “Edge” 2 >> 1 “Corner”1 and 2 are large,1 ~ 2;E increases in all directions 1 and 2 are small;E is almost constant in all directions “Edge” 1 >> 2 “Flat” region 1 Roger S. Gaborski
Defining Corner Response Function, R Recall: A = [ a b; c d] Det(A) = ad – bc Then: R = det(M)- α trace(M)2 = λ1λ2 - α (λ1 + λ2) Where α = .04 to .06 Roger S. Gaborski
Corner Response Function R < 0 R > 0 Edge Corners |R| small R < 0 “Flat” region Edge Roger S. Gaborski
Harris Detector Algorithm • Compute Gaussian Derivatives at each point • Compute Second Moment Matrix M • Compute Corner Response Function • Threshold R • Find Local Maxima Roger S. Gaborski
Harris Corner Detector • Reference: C.G. Harris and M.J. Stephens “A Combined Corner and Edge Detector” • Code inspired by Peter Kovesi • Derivative Masks: dx = [-1, 0, 1;-1, 0, 1;-1, 0, 1] • dy = dx’ • Image Derivatives; • Ix = imfilter(im, dx, 'conv',‘same’); • Iy = imfilter(im, dy, 'conv',‘same’); • Gaussian Filter • g = fspecial(‘gaussian’, 6*sigma, sigma); Roger S. Gaborski
Smooth squared image derivative • Ix2 = imfilter (Ix.^2, g, 'conv', ‘same’); • Iy2 = imfilter (Iy.^2, g, 'conv', ‘same’); • IxIy = imfilter (Ix .* Iy, g, 'conv', ‘same’); c = (Ix2.*Iy2 – IxIy.^2)./(Ix2+Iy2).^2; Roger S. Gaborski
Non-maximal Suppression and Threshold • Extract local maxima – gray scale morphological dilation • size = 2*radius+1; %radius is parameter • mx = imdilate(c,ones(size)); %gray scale dilate • cc = (c==mx)&(c>thresh); %find maxima • [r,c] = find(cc) %find row, col coordinates • figure, imagesc( im), colormap(gray) • hold on • plot(c,r, ‘rs’), title(‘Corners) Roger S. Gaborski
100x100 Grid background =1, lines = 1 Roger S. Gaborski
Image rotated 45 Degrees Roger S. Gaborski
Image rotated 45 Degreessame parameters Roger S. Gaborski
Porsche Image Roger S. Gaborski
Harris Points Roger S. Gaborski
1983 Porsche Roger S. Gaborski
HW#2 – Due Tuesday, noon • Work in teams of 2 or 3 • Write a Harris Detector Function (do not simply copy one from web, write your own) • Experiment with ‘grid image’ and Flower2 image and two ‘interesting’ images of your choice • Goals: - Find all intersections on grid image • Detect all petal end points on flower image – better results that class lecture slide • Email: 1- write up including result images, observations and 2-MATLAB code Roger S. Gaborski
Object Recognition • Issues: • Viewpoint • Scale • Deformable vs. rigid • Clutter • Occlusion • Intra class variability Roger S. Gaborski
Current Work • Fix: • Viewpoint • Scale • Rigid • Explore affects of: • Intra class variability • Clutter • Occlusion Roger S. Gaborski
Goal • Locate all instances of automobiles in a cluttered scene Roger S. Gaborski
Acknowledgements • Students: • Tim Lebo • Dan Clark • Images used in presentation: • ETHZ Database, UIUC Database Roger S. Gaborski
Object Recognition Approaches • For specific object class: • Holistic • Model whole object • Parts based • Simple parts • Geometric relationship information Roger S. Gaborski
Training Images and Segmentation Roger S. Gaborski
Implicit Shape Model • Patches – local appearance prototypes • Spatial relationship – where the patch can be found on the object • For a given class w: ISM(w) = (Iw ,Pw ) where Iw is the codebook containing the patches and Pw is the probability distribution that describes where the patch is found on the object • How do we find ‘interesting’ patches? Roger S. Gaborski
Harris Point Operator • what is it? Roger S. Gaborski
Harris Points Roger S. Gaborski
Segmented Training Mask Segmented mask ensures only patches containing valid car regions are selected A corresponding segmentation patch is also extracted Roger S. Gaborski
Selected Patches Roger S. Gaborski
How is spatial information represented? • Estimate the center of the object using the centroid of the segmentation mask • Displacement between: • Center of patch • Centroid of segmentation mask Roger S. Gaborski
Individual Patch and Displacement Information Roger S. Gaborski
Typical Training Example Roger S. Gaborski
Typical Training Example Roger S. Gaborski
Extracted Training Patches Roger S. Gaborski
Cluster Patches • Many patches will be visually similar • Normalized Grayscale Correlation is used to cluster patches • All patches within a certain neighborhood defined by the NGC are grouped together • The representative patch is determined by mean of the patches • The geometric information for each patch in the cluster is assigned to the representative patch Roger S. Gaborski
Patches Roger S. Gaborski
Wheel Patch Example Roger S. Gaborski
Clusters Opportunity for better clustering method Roger S. Gaborski
Clusters Roger S. Gaborski
Object Detection • Harris point operator to find interesting points • Extract patches • Match extracted patches with model patches • Spatial information predicts center of object • Create voting space Roger S. Gaborski
Ideal Voting Space Example Roger S. Gaborski
Multiple Votes Multiple geometric interpretations Roger S. Gaborski