CEE598 - Visual Sensing for Civil nfrastructure Eng. & Mgmt. Session 9- mage Detectors, Part Mani Golparvar-Fard Department of Civil and Environmental Engineering 3129D, Newmark Civil Engineering Lab e-mail: mgolpar@illinois.edu Department of Civil and Environmental Engineering, Universit of llinois at Urbana-Champaign
Outline mage Detectors, Part Edge feature detectors Corner feature detectors Reading: [FP] Chapters 8,9 Some slides in this lecture are courtes to Prof. S. Savarese, prof F. Li, prof S. Lazebnik, and various other lecturers 2
Goal dentif interesting regions from the images (edges, corners, blobs ) Descriptors e.g. SFT Matching / ndeing / Recognition 3
Linear filtering Convolution: (f g)[m,n] f[k,l] g[m k,n l] k,l Smoothing Differentiation 4
Smoothing with a Gaussian Weight contributions of neighboring piels b nearness 0.003 0.013 0.022 0.013 0.003 0.013 0.059 0.097 0.059 0.013 0.022 0.097 0.159 0.097 0.022 0.013 0.059 0.097 0.059 0.013 0.003 0.013 0.022 0.013 0.003 5 5, = 1 Constant factor at front makes volume sum to 1 (can be ignored, as we should normalize weights to sum to 1 in an case). 5 Slide credit: Christopher Rasmussen
Smoothing with a Gaussian 6
Edge Detection 7
What causes an edge? dentifies sudden changes in an image Depth discontinuit Surface orientation discontinuit Reflectance discontinuit (i.e., change in surface material properties) llumination discontinuit (e.g., shadow) 8
Edge Detection Criteria for optimal edge detection (Cann 86): Good detection accurac: minimize the probabilit of false positives (detecting spurious edges caused b noise), false negatives (missing real edges) Good localization: edges must be detected as close as possible to the true edges. Single response constraint: minimize the number of local maima around the true edge (i.e. detector must return single point for each true edge point) 9
Edge Detection Eamples: True edge Poor robustness to noise Poor localization Too man responses 10
Designing an edge detector Edge: a location with high gradient (thus, use derivatives) Need two derivatives, in and direction. Need smoothing to reduce noise prior to taking derivative 11
f g f * g d d ( f g) Source: S. Seitz derivative of Gaussian filter 12
Cann Edge Detection Most widel used edge detector in computer vision. First derivative of the Gaussian closel approimates the operator that optimizes the product of signal-to-noise ratio and localization. 15
Cann Edge Detection Steps: 1. Gaussian smoothing 2. & Derivative = Derivative of Gaussian 3. Find magnitude and orientation of gradient 4. Etract edge points: Non-maimum suppression 5. Linking and thresholding Hsteresis : Matlab: edge(, cann ) 16
Cann Edge Detector- First 2 Steps Smoothing 17 ) g(, ' 2 2 2 2 2 1 ), ( e g g g S g g g g g g g g g Derivative
Cann Edge Detector Derivative of Gaussian g (, ) g(, ) g (, ) 18
Cann Edge Detector- First 2 Steps S S S g g S S S = gradient vector 19
ncreased smoothing: Eliminates noise edges. Makes edges smoother and thicker. Removes fine detail. 20
Cann Edge Detector- Third Step magnitude and direction of S S S magnitude (S 2 S 2 ) direction tan 1 S S image gradient magnitude 21
Cann Edge Detector - Fourth Step Non maimum suppression 22
Cann Edge Detector - Fourth Step 1. nitialize: - Slice gradient magnitude along the gradient direction - Mark the point along the slide where the magnitude is ma 2. Propagate chain from current point: - Predict net points using the normal to the gradient at that point - Find which point is a local ma magnitude in gradient direction - Retain in magnitude > T 23
Eample: Non-maimum depression Original image Gradient magnitude courtes of G. Lo Non-maima suppressed Slide credit: Christopher Rasmussen 24
Cann Edge Detector - Step 5: Thresholding Set a threshold T to suppress gradients with magnitude < T 25
high threshold (strong edges) low threshold (weak edges) 26
Cann Edge Detector Step 5: Hsteresis Thresholding Hsteresis: A lag or momentum factor dea: Maintain two thresholds k high and k low Use k high to find strong edges to start edge chain Use k low to find weak edges along the edge chain Tpical ratio of thresholds is roughl k high / k low = 2 27
hsteresis threshold 28
29 Effect of (Gaussian kernel spread/size) original Cann with Cann with The choice of depends on desired behavior large detects large scale edges small detects fine features 29 Source: S. Seitz
30 Demo http://www.cs.washington.edu/research/imagedatabase/demo/edge/ 30
Other edge detectors: Sobel Cann-Deriche Differential 31
Etract useful building blocks: Corners 32
Etract useful building blocks: blobs 33
Characteristics Repeatabilit The same feature can be found in several images despite geometric and photometric transformations Salienc Each feature is found at an interesting region of the image Localit A feature occupies a relativel small area of the image; 34
Repeatabilit llumination invariance Scale invariance Pose invariance Rotation Affine 35
Salienc Localit 36
Harris corner detector C.Harris and M.Stephens. "A Combined Corner and Edge Detector. Proceedings of the 4th Alve Vision Conference: pages 147-- 151. 37
Harris Detector: Basic dea Eplore intensit changes within a window as the window changes location flat region: no change in all directions edge : no change along the edge direction corner : significant change in all directions 38
Harris Detector: Mathematics Change of intensit for the shift [u,v ]:, Proportional to the gradient 2 E( u, v) w(, ) ( u, v) (, ) Window function Shifted intensit ntensit Window function w(,) = or 1 in window, 0 outside Gaussian 39
Harris Detector: Mathematics For small shifts [u,v ] we have a bilinear approimation: u E( u, v) u, v M v where M is a 22 matri computed from image derivatives: M 2 w(, ) 2, W W 2 W W 2 40
2 2 W W W W M Sum over a small region around the hpothetical corner (we can omit w ) Gradient with respect to, times gradient with respect to Matri is smmetric Slide credit: David Jacobs g g Second-moment matri 41
2 2 M First, consider case where dominant gradient directions aligned with or 2 1 0 0 Second-moment matri 42
2 2 M First, consider case where dominant gradient directions aligned with or 2 1 0 0 f either λ is close to 0, then this is an edge Second-moment matri 43 analzing the eigenvalues of A Structure tensor
2 2 M First, consider case where dominant gradient directions aligned with or 2 1 0 0 f both λs are close to 0, then this is a flat region Second-moment matri 44
2 2 M For generic window alignments, the eigenvalue decomposition of M returns similar information: U 0 0 U 2 1 1 Lambda 1, 2 are the eigenvalues of M Second-moment matri 45
2 2 M For generic window alignments, the eigenvalue decomposition of M returns similar information: U 0 0 U 2 1 1 Non-zero eigenvector of M gives direction of the edge f either λ is close to 0, then this is an edge Second-moment matri 46
Harris Detector: Mathematics 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 Flat region Edge 1 >> 2 1 47
48
49
Harris Detector: Mathematics Measure of corner response: R det M k M trace 2 det M trace M 1 2 1 2 (k empirical constant, k = 0.04-0.06) 50
Harris Detector: Algorithm Filter image with Gaussian to reduce noise Compute magnitude of the and gradients at each piel Construct M in a window around each piel (Harris uses a Gaussian window) Compute s of M Compute f R> T a corner is detected; retain point of local maima R det M k M trace 2 51
Harris Detector: Mathematics R depends onl on eigenvalues of M 2 Edge R < 0 Corner R is large for a corner R > 0 R is negative with large magnitude for an edge R is small for a flat region Flat Edge R small R < 0 1 52
Harris Detector: Workflow 53
Harris Detector: Workflow Compute corner response R 54
Harris Detector: Workflow Find points with large corner response: R>threshold 55
Harris Detector: Workflow Take onl the points of local maima of R 56
Harris Detector: Workflow 57
Harris Detector: Some Properties Rotation invariance Corner response R is invariant to image rotation C 0 11 U U 0 2 R = R( 1, 1 ) doesn t change! 58
Harris Detector: Some Properties But: non-invariant to image scale! All points will be classified as edges Corner! 59
Harris Detector: Some Properties Partial invariance to affine intensit change invariance to intensit shift + b (wh?) (onl derivatives are used) ntensit scale: a R threshold R (image coordinate) (image coordinate) 60
Net lecture: Descriptors Detectors part 2 61