Image Analysis Feature Extraction: Corners and Blobs Corners And
Total Page:16
File Type:pdf, Size:1020Kb
2 Corners and Blobs Image Analysis Feature extraction: corners and blobs Christophoros Nikou [email protected] Images taken from: Computer Vision course by Svetlana Lazebnik, University of North Carolina at Chapel Hill (http://www.cs.unc.edu/~lazebnik/spring10/). D. Forsyth and J. Ponce. Computer Vision: A Modern Approach, Prentice Hall, 2003. M. Nixon and A. Aguado. Feature Extraction and Image Processing. Academic Press 2010. University of Ioannina - Department of Computer Science C. Nikou – Image Analysis (T-14) Motivation: Panorama Stitching 3 Motivation: Panorama Stitching 4 (cont.) Step 1: feature extraction Step 2: feature matching C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) Motivation: Panorama Stitching 5 6 Characteristics of good features (cont.) • Repeatability – The same feature can be found in several images despite geometric and photometric transformations. • Saliency – Each feature has a distinctive description. • Compactness and efficiency Step 1: feature extraction – Many fewer features than image pixels. Step 2: feature matching • Locality Step 3: image alignment – A feature occupies a relatively small area of the image; robust to clutter and occlusion. C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) 1 7 Applications 8 Image Curvature • Feature points are used for: • Extends the notion of edges. – Motion tracking. • Rate of change in edge direction. – Image alignment. • Points where the edge direction changes rapidly are characterized as corners. – 3D reconstruction. • We need some elements from differential ggyeometry. – Objec t recogn ition. • Parametric form of a planar curve: – Image indexing and retrieval. – Robot navigation. Ct()= [ xt (),()] yt • Describes the points in a continuous curve as the endpoints of a position vector. C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) 9 Image Curvature (cont.) 10 Image Curvature (cont.) • The tangent vector describes changes in • At any time moment, the point moves the position vector: with velocity magnitude: ⎡⎤dx dy Tt()== Ct () [ xt (),()] yt = , Ct()=+ x22 () t y () t ⎣⎦⎢⎥dt dt • Intuitive meaning – think of the trace of the curve as the motion in the direction: of a point at time t. −1 ⎛⎞yt() ϕ()t = tan ⎜⎟ – The tangent vector describes the x()t instantaneous motion. ⎝⎠ C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) 11 Image Curvature (cont.) 12 Image Curvature (cont.) Gradient direction N(t) • The curvature at a point C(t) describes the changes in the direction of the tangent with respect to changes in arc length: φ(t) dϕ()t κ()t = ds Tangent T(t) Edge curve C(t) • The curvature is given with respect to the arc length because a curve parameterized dtϕ() by the arc length maintains a constant κ()t = velocity. ds C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) 2 13 Image Curvature (cont.) 14 Image Curvature (cont.) • Parameterization of a planar curve by the • Parameterization by the arc length is not arc length is the length of the curve from 0 unique but it has the property: to t: t dC() t dC() t dC () t s()tdt= dC() t ∫0 dt ddddCt()dCt ()dt dt dt = ====dt 1 ds dt ds ds ds dC() t • This implies: dt dt dt ds() t d⎛⎞t dC () t dC () t ===+dt x22() t y () t ⎜⎟∫0 dt dt⎝⎠ dt dt C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) 15 Image Curvature (cont.) 16 Image Curvature (cont.) • Back to the definition of curvature: • Some useful relations from differential geometry of planar curves (easily deduced) are: dtϕϕ() dtdt () κ()t == dC() t dC2 () t ds dt ds = Tt() = κ()tNt () ds ds2 dy⎛⎞−1 ⎛⎞ 1 = ⎜⎟tan ⎜⎟ dt⎝⎠ x 22 • The curvature is the magnitude of the second derivative ⎝⎠x()tyt+ () of the curve with respect to the arc length: x()tyt ()− ytxt () () dC2 () t ⇔=κ()t κ()t = 223/2 ds2 ⎣⎦⎡⎤xt()+ yt () C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) 17 Image Curvature (cont.) 18 Image Curvature (cont.) • It is also useful to express the normal vector at a point to • There are three main approaches to a curve in Cartesian coordinates: compute curvature – Direct computation on an edge image. ⎡⎤yt()− xt () Nt()=⊥=⎢⎥, Tt () [ xt (), yt ()] – Derive the measure of curvature from image 22 22 intensities. ⎣⎦⎢+xt() yt ()xt () +⎥ yt () – Correlation. x()tyt ()− ytxt () () κ()t = 223/2 ⎣⎡xt()+ yt ()⎦⎤ C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) 3 19 Image Curvature (cont.) 20 Image Curvature (cont.) • Direct computation from edges. • Direct computation from edges. – Difference in edge direction. – Smoothing is generally required by considering more than two pixels: κ()tt=+−−ϕϕ ( 1) ( t 1) 1 n κ()tt= ∑ϕϕ (++ 1iii ) − (t +−i 1) n i=1 −1 ⎛⎞yt(1)(1)+− yt − with ϕ()t = tan ⎜⎟ – Not very reliable results. ⎝⎠xt(1)(1)+− xt − – Reformulation of a first order edge detection scheme. • Connected edges are needed (hysteresis). – Quantization errors in angle measurement. – Threshold to detect corners. C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) 21 Image Curvature (cont.) 22 Image Curvature (cont.) • Direct computation from edges. • Computation from image intensity. – It should be computed along the curve (normal to the image gradient) for each pixel. – Cartesian coordinates for the angle of the tangent φ(x,y). – Measure of angular changes in the image with respect to location φ’(x,y). – The curve at an image point may be approximated by: x()txt=+ cos(ϕ′ ( xy , )) Object silhouette Thresholded curvature yt()=+ y t sin()ϕ′ ( xy , ) • The result depends strongly on the threshold. C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) 23 Image Curvature (cont.) 24 Image Curvature (cont.) • Computation from image intensity. • Computation from image intensity. – The curvature is given by: – Substituting the all the terms: ∂∂MM ∂∂∂∂∂ϕ′′(,x y )ϕϕ (, xyxt ) () ′ (, xyyt ) () 1 ⎧ 22∂∂MMxxyy ⎫ κ (,xy )== + κϕ′ (,xy )=−+−3/2 ⎨ Myxyxxy MM M MM ⎬ ϕ′ 22 ∂∂∂∂x xy y ∂∂∂∂∂txtyt (M xy+ M ) ⎩⎭ with ∂∂xt() yt () ==cos()ϕϕ′′ (x ,yxy ) , sin() ( , ) , ∂∂tt – Alternatively, by differentiating backwards: ⎛⎞ −1 M 1 ⎧ ∂∂MM∂∂MM ⎫ ′ x Normal to the curve. Recall 22xxyy ϕ (,xy )=− tan ⎜⎟ κ−ϕ′ (,xy )=−−+⎨ Myxyxxy MM M MM ⎬ ⎜⎟M that this is associated with 223/2 ∂∂∂∂x xy y ⎝⎠y ()MMxy+ ⎩⎭ the Css(t). C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) 4 25 Image Curvature (cont.) 26 Image Curvature (cont.) • Computation from image intensity. • Computation from image intensity. – Other measures differentiate along the normal to the – The measures are: curve. 1 ⎧ ∂∂∂MMM∂M ⎫ κ (,xy )=−−+ M2 yyy MM MM MM x – The idea is that curves may be thicker than one pixel ⊥ϕ′ 3/2 ⎨ xxyxyxy⎬ M 22+ M ⎩⎭∂∂∂∂xxyy wide. ( xy) – Differentiating along the normal measures the difference between internal and external gradient angles. – Theoretically, these are equal. However, in practice they 1 ⎧ 22∂∂MMyy∂∂MMxx⎫ κ−⊥ϕ′ (,xy )=−+−+⎨ Mxxyxyy MM MM M ⎬ differ due to image discretization. 223/2 ∂∂∂∂xxyy ()MMxy+ ⎩⎭ – The more the edge is bent, the larger the difference (Kass et al. IJCV 1988). C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) Finding Corners – Image Curvature 27 Image Curvature (cont.) 28 by Correlation • Computation from image intensity. κϕ′ κ−ϕ′ • Key property: in the region around a corner, image gradient has two or more dominant directions. κ⊥ϕ′ κ−⊥ϕ′ • Corners are repeatable and distinctive. C.Harris and M.Stephens. "A Combined Corner and Edge Detector.“ Better than direct computation but the results are not consistent. Proceedings of the 4th Alvey Vision Conference: pages 147--151. C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) 29 The Basic Idea 30 Harris Corner Detector • We should easily recognize the point by looking Change in appearance for the shift [u,v]: through a small window. • Shifting a window in any direction should give a E(,)uv=++− wxy (,)( I x uy , v ) I (,) xy 2 large change in intensity. ∑ [ ] xy, Window Shfhifte d Intensity function intensity Window function w(x,y) or “flat” region: “edge”: “corner”: no change in all no change along significant change directions the edge direction in all directions 1 in window, 0 outside Gaussian Source: A. Efros C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) Source: R. Szeliski 5 31 Harris Detector (cont.) 32 Harris Detector (cont.) Change in appearance for the displacement [u,v]: The bilinear approximation simplifies to 2 ⎡u⎤ E(,)uv=++−∑ wxy (,)([ I x uy , v ) I (,) xy] E(u,v) ≈ [u v] M ⎢ ⎥ xy, ⎣v⎦ where M is a 2×2 matrix computed from image derivatives: Second-order Taylor expansion of E(u,v) around (0,0): ⎡ III2 ⎤ Mwxy= (, ) x xy ⎡E (0,0)⎤ 1 ⎡E (0,0) E (0,0)⎤⎡u⎤ ∑ ⎢ 2 ⎥ u uu uv xy, ⎢IIxy I y⎥ E(u,v) ≈ E(0,0) +[u v]⎢ ⎥ + [u v]⎢ ⎥⎢ ⎥ ⎣ ⎦ ⎣Ev (0,0)⎦ 2 ⎣Euv (0,0) Evv (0,0)⎦⎣v⎦ M C. Nikou – Image Analysis (T-14) C. Nikou – Image Analysis (T-14) 33 Harris Detector (cont.) 34 Harris Detector (cont.) The surface E(u,v) is locally approximated by a quadratic First, consider the axis-aligned case where gradients are form. Let’s try to understand its shape. either horizontal or vertical. ⎡u⎤ ⎡ I 2 I I ⎤ λ 0 E(u,v) ≈ [u v] M ⎢ ⎥ x x y ⎡ 1 ⎤ ⎣v⎦ M = ∑ ⎢ 2 ⎥ = ⎢ ⎥ ⎣⎢I x I y I y ⎦⎥ ⎣ 0 λ2 ⎦ 2 ⎡ I x I x I y ⎤ If either λ is close to 0, then this is not a corner, so look for M = ∑ ⎢ 2 ⎥ locations where both are large. ⎣⎢I x I y I y ⎦⎥ C.