Image Analysis. Edge Detection

Similar documents
Image Analysis. Edge Detection

Edge detection. Goal: Identify sudden. an image. Ideal: artist s line drawing. object-level knowledge)

Edge detection. Winter in Kraków photographed by Marcin Ryczek

Edge and corner detection

Edge and Texture. CS 554 Computer Vision Pinar Duygulu Bilkent University

Lecture 7: Most Common Edge Detectors

Edge detection. Winter in Kraków photographed by Marcin Ryczek

Edge Detection CSC 767

CS334: Digital Imaging and Multimedia Edges and Contours. Ahmed Elgammal Dept. of Computer Science Rutgers University

convolution shift invariant linear system Fourier Transform Aliasing and sampling scale representation edge detection corner detection

CS534: Introduction to Computer Vision Edges and Contours. Ahmed Elgammal Dept. of Computer Science Rutgers University

Lecture 6: Edge Detection

Review of Filtering. Filtering in frequency domain

Edges and Binary Images

DIGITAL IMAGE PROCESSING

Prof. Feng Liu. Winter /15/2019

Edge Detection. CSC320: Introduction to Visual Computing Michael Guerzhoy. René Magritte, Decalcomania. Many slides from Derek Hoiem, Robert Collins

Edge Detection. CSE 576 Ali Farhadi. Many slides from Steve Seitz and Larry Zitnick

What is an edge? Paint. Depth discontinuity. Material change. Texture boundary

Solution: filter the image, then subsample F 1 F 2. subsample blur subsample. blur

CS 4495 Computer Vision. Linear Filtering 2: Templates, Edges. Aaron Bobick. School of Interactive Computing. Templates/Edges

Biomedical Image Analysis. Point, Edge and Line Detection

Digital Image Processing COSC 6380/4393

Edge Detection (with a sidelight introduction to linear, associative operators). Images

Local Image preprocessing (cont d)

Computer Vision I. Announcement. Corners. Edges. Numerical Derivatives f(x) Edge and Corner Detection. CSE252A Lecture 11

Edge Detection. Computer Vision Shiv Ram Dubey, IIIT Sri City

Edge and local feature detection - 2. Importance of edge detection in computer vision

Computer Vision I. Announcements. Fourier Tansform. Efficient Implementation. Edge and Corner Detection. CSE252A Lecture 13.

Edge Detection Lecture 03 Computer Vision

Anno accademico 2006/2007. Davide Migliore

2%34 #5 +,,% ! # %& ()% #% +,,%. & /%0%)( 1 ! # %& % %()# +(& ,.+/ +&0%//#/ &

Digital Image Processing. Image Enhancement - Filtering

Lecture 4: Finding lines: from detection to model fitting

Segmentation and Grouping

Edge detection. Convert a 2D image into a set of curves. Extracts salient features of the scene More compact than pixels

Edge Detection. Announcements. Edge detection. Origin of Edges. Mailing list: you should have received messages

Edge detection. Stefano Ferrari. Università degli Studi di Milano Elaborazione delle immagini (Image processing I)

Other Linear Filters CS 211A

Image gradients and edges

Multimedia Computing: Algorithms, Systems, and Applications: Edge Detection

CS5670: Computer Vision

[ ] Review. Edges and Binary Images. Edge detection. Derivative of Gaussian filter. Image gradient. Tuesday, Sept 16

What Are Edges? Lecture 5: Gradients and Edge Detection. Boundaries of objects. Boundaries of Lighting. Types of Edges (1D Profiles)

Image gradients and edges

Image gradients and edges April 11 th, 2017

Image gradients and edges April 10 th, 2018

Comparison between Various Edge Detection Methods on Satellite Image

Neighborhood operations

PERFORMANCE ANALYSIS OF CANNY AND OTHER COMMONLY USED EDGE DETECTORS Sandeep Dhawan Director of Technology, OTTE, NEW YORK

Image Understanding Edge Detection

Low-level Vision Processing Algorithms Speaker: Ito, Dang Supporter: Ishii, Toyama and Y. Murakami

Topic 4 Image Segmentation

Image Analysis Image Segmentation (Basic Methods)

Does everyone have an override code?

Announcements. Edge Detection. An Isotropic Gaussian. Filters are templates. Assignment 2 on tracking due this Friday Midterm: Tuesday, May 3.

Announcements. Edges. Last Lecture. Gradients: Numerical Derivatives f(x) Edge Detection, Lines. Intro Computer Vision. CSE 152 Lecture 10

Image features. Image Features

Filtering in frequency domain

Edge detection. Gradient-based edge operators

Filtering Images. Contents

Edge Detection. EE/CSE 576 Linda Shapiro

Edges and Binary Image Analysis April 12 th, 2018

CS4670: Computer Vision Noah Snavely

Edge Detection. Today s reading. Cipolla & Gee on edge detection (available online) From Sandlot Science

Previously. Edge detection. Today. Thresholding. Gradients -> edges 2/1/2011. Edges and Binary Image Analysis

Ulrik Söderström 16 Feb Image Processing. Segmentation

CS 2770: Computer Vision. Edges and Segments. Prof. Adriana Kovashka University of Pittsburgh February 21, 2017

Edges, interpolation, templates. Nuno Vasconcelos ECE Department, UCSD (with thanks to David Forsyth)

Image Processing

Image Processing. BITS Pilani. Dr Jagadish Nayak. Dubai Campus

SURVEY ON IMAGE PROCESSING IN THE FIELD OF DE-NOISING TECHNIQUES AND EDGE DETECTION TECHNIQUES ON RADIOGRAPHIC IMAGES

EE795: Computer Vision and Intelligent Systems

Edge Detection. CS664 Computer Vision. 3. Edges. Several Causes of Edges. Detecting Edges. Finite Differences. The Gradient

Filtering Applications & Edge Detection. GV12/3072 Image Processing.

Lecture: Edge Detection

Robust Zero Watermarking for Still and Similar Images Using a Learning Based Contour Detection

CAP 5415 Computer Vision Fall 2012

Feature Detectors - Canny Edge Detector

Local Features: Detection, Description & Matching

How and what do we see? Segmentation and Grouping. Fundamental Problems. Polyhedral objects. Reducing the combinatorics of pose estimation

EECS490: Digital Image Processing. Lecture #20

Edges and Binary Image Analysis. Thurs Jan 26 Kristen Grauman UT Austin. Today. Edge detection and matching

Edge Detection. Ziv Yaniv School of Engineering and Computer Science The Hebrew University, Jerusalem, Israel.

SRCEM, Banmore(M.P.), India

CPSC 425: Computer Vision

Straight Lines and Hough

An Algorithm for Blurred Thermal image edge enhancement for security by image processing technique

Line, edge, blob and corner detection

Concepts in. Edge Detection

ME/CS 132: Introduction to Vision-based Robot Navigation! Low-level Image Processing" Larry Matthies"

Practical Image and Video Processing Using MATLAB

Filtering and Edge Detection. Computer Vision I. CSE252A Lecture 10. Announcement

Filtering and Enhancing Images

Biometrics Technology: Image Processing & Pattern Recognition (by Dr. Dickson Tong)

EN1610 Image Understanding Lab # 3: Edges

Feature Detectors and Descriptors: Corners, Lines, etc.

COMPARATIVE STUDY OF IMAGE EDGE DETECTION ALGORITHMS

EDGE DETECTION-APPLICATION OF (FIRST AND SECOND) ORDER DERIVATIVE IN IMAGE PROCESSING

Feature Detectors - Sobel Edge Detector

Transcription:

Image Analysis Edge Detection Christophoros Nikou cnikou@cs.uoi.gr Images taken from: Computer Vision course by Kristen Grauman, University of Texas at Austin (http://www.cs.utexas.edu/~grauman/courses/spring2011/index.html). 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. R. Gonzalez and R. Woods. Digital Image Processing, Prentice Hall, 2008. University of Ioannina - Department of Computer Science 2 Edge detection Goal: Identify sudden changes (discontinuities) in an image. Intuitively, most semantic and shape information from the image can be encoded in the edges. More compact than pixels. Ideal: artist s line drawing (artist also uses object-level knowledge) Source: D. Lowe 1

3 Origin of Edges surface normal discontinuity depth discontinuity surface color discontinuity illumination discontinuity Edges are caused by a variety of factors Source: Steve Seitz 4 Edge model 2

5 Edge model (cont.) Edge point detection Magnitude of the first derivative. Sign change of the second derivative. Observations: Second derivative produces two values for an edge (undesirable). Its zero crossings may be used to locate the centres of thick edges. 6 Image gradient The gradient of an image: The gradient points in the direction of most rapid increase in intensity The gradient direction is given by how does this relate to the direction of the edge? The edge strength is given by the gradient magnitude Source: Steve Seitz 3

7 Differentiation and convolution Recall, for 2D function, f(x,y): ( ) ( ) f x = lim f x + ε, y f x, y ε 0 ε ε This is linear and shift invariant. It is therefore the result of a convolution. Approximation: ( ) f ( x n, y ) f x f x n+1,y Δx which is a convolution with the mask: -1 1 Source: D. Forsyth, D. Lowe 8 Finite difference filters Other approximations of derivative filters: Source: K. Grauman 4

9 Finite differences: example 10 Effect of Finite Differences on White Noise Let f be an observed instance of the image f 0 corrupted by noise w: f = f0 + w with noise samples having mean value E[w(n)]=0 [ ( and being uncorrelated with respect to location: σ 2, m= n Ewmwn [ ( ) ( )] = 0, m n 5

11 Effect of Finite Differences on White Noise (cont.) Applying a filter h to the degraded image: g = h * f = h *( f0 + w ) = h* f0 + h* w The expected value of the output is: Eg [ ] Eh [ * f ] Eh [ * w] = 0 + 0 = h* f + h*0 = h* f0 0 The noise is removed in average. = h* f + h* E[ w] 12 Effect of Finite Differences on White Noise (cont.) What happens to the standard deviation of g? σ N 2 2 2 g = σ h i= 1 ( k) Assume that a finite difference filter is used, which approximates the first derivative: -1 1 σ = 2σ 2 2 g 6

13 Effect of Finite Differences on White Noise (cont.) For a second derivative approximation: 0 1 0 0-2 0 0 1 0 σ = 6σ 2 2 g The standard deviation increases sharply! Higher order coefficients form a Pascal triangle. 14 Effect of Finite Differences on White Noise (cont.) Another perspective: differentiation in the Fourier domain: d f ( x ) j Ω F ( Ω) dx High frequencies are heavily emphasized with respect to low spatial frequencies. 7

15 Edge model and noise Intensity profile First derivative Second derivative 16 Edge model and noise (cont.) Intensity profile First derivative Second derivative 8

17 Noise Edge detectors respond strongly to sharp changes and noise is a sharp change. As we have seen, simple finite differences are unusable. Noise is sometimes useful! Pictures in a dark room with the lens cap on helps to determine information about the camera temperature. 18 Noise (cont.) Independent additive stationary Gaussian noise is the simplest model. Issues this model allows noise values that could be greater than maximum camera output or less than zero. for small standard deviations, this isn t too much of a problem - it s a fairly good model. independence may not be justified (e.g. damage to lens). may not be stationary (e.g. thermal gradients in the ccd). 9

19 Why smoothing helps Smoothing (e.g. average) kernels have N N N N 2 hi (, j) = 1 h (, i j) 1 i= 1 j= 1 i= 1 j= 1 Therefore, the noise standard deviation is reduced at the output, as we saw before. Also, after smoothing (e.g. average), noise samples are no longer independent. They look like their neighbors and the derivatives are smaller. 20 Application of noise smoothing In computer graphics, noise smoothing is widely used as it is a source of representing natural textures (e.g. smoke). 10

21 Noisy Edge Smoothing f g f * g d ( f g) dx To find edges, look for peaks in ( f g) d dx Source: S. Seitz 22 Convolution property d ( f g) = f dx Convolve with the derivative of the filter. d dx g f d g dx d f dx g Source: S. Seitz 11

23 Derivative of Gaussian * [1-1] = 24 Derivative of Gaussian (cont.) x-direction y-direction 12

25 Tradeoff between smoothing and localization σ =1 σ =3 σ =7 Smoothed derivative removes noise but blurs edge. It also finds edges at different scales affecting the semantics of the edge. Source: D. Forsyth 26 The LoG operator A good place to look for edges is the maxima of the first derivative or the zeros of the second derivative. The 2D extension approximates the second derivative by the Laplacian operator (which is rotationally invariant): f x f y 2 2 2 f( x, y) = + 2 2 Marr and Hildreth [1980] argued that t a satisfactory t operator that could be tuned in scale to detect edges is the Laplacian of the Gaussian (LoG). D. Marr and E. Hildreth. Theory of Edge Detection, Proceedings of the Royal Society of London, B-207, pp. 187-207, 1980. 13

27 The LoG operator (cont.) ( ) 2 2 Gxy (, )* f( x, y) = Gxy (, )* f( x, y) The LoG operator is given by: 2 2 2 2 2 2 2 x + y 2 G G x + y 2σ 2 2σ Gxy (, ) e 2 2 4 = + = x y σ The zero crossings of the operator indicate edge pixels. These may be computed, for instance, by using a 3x3 window around a pixel and detect if two of its opposite neighbors have different signs (and their difference is significant compared to a threshold) in result of the LoG operator. 28 The LoG operator (cont.) 2 2 2 2 2 2 2 x + y 2 G G x + y 2σ 2 2σ Gxy (, ) e 2 2 4 = + = x y σ 14

29 The LoG operator (cont.) Image LoG Zero crossings Zero crossings with a threshold of 4% of the image max 30 The LoG operator (cont.) Contrast threshold = 1 Contrast threshold = 4 σ =2 σ =4 15

31 The LoG operator (cont.) Filter the image at various scales and keep the zero crossings that are common to all responses. Marr and Hildreth [1980] showed that LoG may be approximated by a difference of Gaussinas (DOG): 2 2 2 2 x + y x + y 2 2 2σ1 2σ2 2 2 1 πσ 2 1 1 DoG( xy, ) = e e, σ1 > σ 2 2πσ 2 Certain channels of the human visual system are selective with respect to orientation and frequency and can be modeled by a DoG with a ratio of standard deviations of 1.75. 32 The LoG operator (cont.) Meaningful comparison between LoG and DoG may be obtained after selecting the value of σ for LoG so that LoG has the same zero crossings as DoG: 2 2 2 2 σ1σ 2 σ 1 σ = ln 2 2 2 σ1 σ 2 σ 2 The two functions should also be scaled to have the same value at the origin. 16

33 The LoG operator (cont.) LoG has fallen to some disfavour. It is not oriented and its response averages the responses across the two directions. Poor response at corners. Difficulty in recording the topology of T-junctions (trihedral vertices). Several studies showed that image components along an edge contribute to the response of LoG to noise but not to a true edge. Thus, zero crossings may not lie exactly on an edge. 34 The LoG operator (cont.) Poor corner and trihedral vertices detection 17

35 Problems with gradient-based edge detectors σ =1 σ =2 There are three major issues: 1. The gradient magnitude at different scales is different; which scale should we choose? 2. The gradient magnitude is large along thick trail; how do we identify only the significant points? 3. How do we link the relevant points up into curves? 36 Designing an optimal edge detector Criteria for an optimal edge detector [Canny 1986]: Good detection: the optimal detector must minimize the probability of false positives (detecting spurious edges caused by noise), as well as that t of false negatives (missing i real edges). Good localization: the edges detected must be as close as possible to the true edges Single response: the detector must return one point only for each true edge point; that is, minimize the number of local maxima around the true edge. Source: L. Fei-Fei 18

37 Canny edge detector Probably the most widely used edge detector in computer vision. Theoretical model: step-edges corrupted by additive Gaussian noise. Canny has shown that the first derivative of the Gaussian closely approximates the operator that optimizes the product of signalto-noise ratio and localization. J. Canny, A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis and Machine Intelligence, 8:679-714, 1986. Source: L. Fei-Fei 38 Canny edge detector (cont.) 1. Filter image with derivative of Gaussian. 2. Find magnitude and orientation of gradient. 3. Non-maximum suppression: Thin multi-pixel wide ridges down to single pixel width. 4. Linking and thresholding (hysteresis): Define two thresholds: low and high Use the high threshold to start edge curves and the low threshold to continue them. Source: D. Lowe, L. Fei-Fei 19

39 Canny edge detector (cont.) original image 40 Canny edge detector (cont.) Gradient magnitude 20

41 Canny edge detector (cont.) Non-maximum suppression and hysteresis thresholding 42 Non-maximum suppression (cont.) We wish to mark points along the curve where the gradient magnitude is biggest. We can do this by looking for a maximum along a slice normal to the curve (nonmaximum suppression). These points should form a curve. There are then two algorithmic issues: at which point is the maximum, and where is the next one? Source: D. Forsyth 21

43 Non-maximum suppression (cont.) At pixel q, we have a maximum if the value of the gradient magnitude is larger than the values at both p and at r. Interpolation provides these values. Source: D. Forsyth 44 Edge linking Assume the marked point is an edge point. Then we construct the tangent to the edge curve (which is normal to the gradient at that point) and use this to predict the next points (here either r or s). Source: D. Forsyth 22

45 Hysteresis Thresholding Reduces false edge pixels. It uses a low (T L ) and a high threshold (T H ) to create two additional images from the gradient magnitude image g (x,y): gxy (, ) gxy (, ) TL gxy (, ) gxy (, ) T gl( x, y) =, gh( x, y) = 0 otherwise 0 otherwise g L (x,y) has more non zero pixels than g H (x,y). We eliminate from g L (x,y) all the common non zero pixels: g ( x, y) = g ( x, y) g ( x, y) L L H g L (x,y) and g H (x,y) may be viewed as weak and strong edge pixels. Canny suggested a ratio of 2:1 to 3:1 between the thresholds. Source: S. Seitz H 46 Hysteresis Thresholding (cont.) After the thresholdings, all strong pixels are assumed to be valid edge pixels. Depending on the value of T H, the edges in g H (x,y) typically have gaps. All pixels in g L (x,y) are considered valid edge pixels if they are 8-connected to a valid edge pixel in g H (x,y). Source: S. Seitz 23

47 Hysteresis thresholding (cont.) high threshold (strong edges) low threshold (weak edges) hysteresis threshold Source: L. Fei-Fei 48 Canny vs LoG Image Thresholded gradient LoG Canny 24

49 Canny vs LoG Image Thresholded gradient LoG Canny 50 Edge Linking Even after hysteresis thresholding, the detected pixels do not completely characterize edges completely due to occlusions, non-uniform illumination and noise. Edge linking may be: Local: requiring knowledge of edge points in a small neighborhood. Regional: requiring knowledge of edge points on the boundary of a region. Global: the Hough transform, involving the entire edge image, will be presented at a later stage in the course. 25

51 Edge Linking by Local Processing A simple algorithm: 1. Compute the gradient magnitude and angle arrays M(x,y) and a(x,y) of the input image f(x,y). 2. Let S xy denote the neighborhood of pixel (x,y). 3. A pixel (s,t) in S xy in is linked to (x,y) if: M ( xy, ) Mst (, ) Eand axy (, ) ast (, ) A A record of linked points must be kept as the center of S xy moves. Computationally expensive as all neighbors of every pixel should be examined. 52 Edge Linking by Local Processing (cont.) A faster algorithm: 1. Compute the gradient magnitude and angle arrays M(x,y) ) and a(x,y) ( ) of fthe input timage f(x,y). ) 2. Form a binary image: 1 M ( xy, ) TM and axy (, ) [ A TA, A+ TA] gxy (, ) = 0 otherwise 3. Scan the rows of g(x,y) (for Α=0) and fill (set to 1) all gaps (zeros) that do not exceed a specified length K. 4. To detect gaps in any other direction Α=θ, rotate g(x,y) by θ and apply the horizontal scanning. 26

53 Edge Linking by Local Processing (cont.) Image Gradient magnitude Horizontal linking We may detect the licence plate from the ratio width/length (2:1 in the USA) Vertical linking Logical OR Morphological thinning 54 Edge Linking by Regional Processing Often, the location of regions of interest is known and pixel membership to regions is available. Approximation of the region boundary by fitting a polygon. Polygons are attractive because: They capture the essential shape. They keep the representation simple. Requirements Two starting points must be specified (e.g. rightmost and leftmost points). The points must be ordered (e.g. clockwise). 27

55 Edge Linking by Regional Processing (cont.) Variations of the algorithm handle both open and closed curves. If this is not provided, it may be determined by distance criteria: Uniform separation between points indicate a closed curve. A relatively large distance between consecutive points with respect to the distances between other points indicate an open curve. We present here the basic mechanism for polygon fitting. 56 Given the end points A and B, compute the straight line AB. Compute the perpendicular distance from all other points to this line. If this distance exceeds a threshold, the corresponding point C having the maximum distance from AB is declared a vertex. Compute lines AC and CB and continue. Edge Linking by Regional Processing (cont.) 28

57 Edge Linking by Regional Processing (cont.) Regional processing for edge linking is used in combination with other methods in a chain of processing. 58 Edge detection is just the beginning image human segmentation gradient magnitude Berkeley segmentation database: http://www.eecs.berkeley.edu/research/projects/cs/vision/grouping/segbench/ 29

59 Learning to detect image boundaries Learn from humans which combination of features is most indicative of a good contour? D. Martin, C. Fowlkes and J. Malik. Learning to detect natural image boundaries using local brightness, color and texture cues. IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 26, No 5, pp. 530-549, 2004. 60 What features are responsible for perceived edges? Feature profiles (oriented energy, brightness, color, and texture gradients) along the patch s horizontal diameter D. Martin, C. Fowlkes and J. Malik. Learning to detect natural image boundaries using local brightness, color and texture cues. IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 26, No 5, pp. 530-549, 2004. 30

61 What features are responsible for perceived edges? (cont.) D. Martin, C. Fowlkes and J. Malik. Learning to detect natural image boundaries using local brightness, color and texture cues. IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. 26, No 5, pp. 530-549, 2004. 31