Image gradients and edges

Similar documents
Image gradients and edges April 11 th, 2017

Image gradients and edges April 10 th, 2018

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

Image gradients and edges

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

Edges and Binary Image Analysis April 12 th, 2018

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

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

Edge Detection CSC 767

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

Edges and Binary Images

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

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

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

Prof. Feng Liu. Winter /15/2019

Review of Filtering. Filtering in frequency domain

Edge and corner detection

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

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

Lecture 6: Edge Detection

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

CS4670: Computer Vision Noah Snavely

DIGITAL IMAGE PROCESSING

CS5670: Computer Vision

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

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

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

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

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

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

Image Analysis. Edge Detection

Anno accademico 2006/2007. Davide Migliore

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

Image Analysis. Edge Detection

Lecture 7: Most Common Edge Detectors

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

Digital Image Processing. Image Enhancement - Filtering

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

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

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

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

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

Other Linear Filters CS 211A

Edge Detection Lecture 03 Computer Vision

Topic 4 Image Segmentation

Filtering Images. Contents

Local Image preprocessing (cont d)

Digital Image Processing COSC 6380/4393

Straight Lines and Hough

Edge Detection. EE/CSE 576 Linda Shapiro

Comparison between Various Edge Detection Methods on Satellite Image

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

Perception. Autonomous Mobile Robots. Sensors Vision Uncertainties, Line extraction from laser scans. Autonomous Systems Lab. Zürich.

Filtering in frequency domain

Lecture 4: Finding lines: from detection to model fitting

Neighborhood operations

Image Processing

SIFT: SCALE INVARIANT FEATURE TRANSFORM SURF: SPEEDED UP ROBUST FEATURES BASHAR ALSADIK EOS DEPT. TOPMAP M13 3D GEOINFORMATION FROM IMAGES 2014

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

EN1610 Image Understanding Lab # 3: Edges

Does everyone have an override code?

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

Edge detection. Gradient-based edge operators

Practical Image and Video Processing Using MATLAB

CS4442/9542b Artificial Intelligence II prof. Olga Veksler

Segmentation and Grouping

Lecture 4: Image Processing

Lecture: Edge Detection

Lecture 4: Spatial Domain Transformations

CS4442/9542b Artificial Intelligence II prof. Olga Veksler

EECS490: Digital Image Processing. Lecture #19

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

Filters and Pyramids. CSC320: Introduction to Visual Computing Michael Guerzhoy. Many slides from Steve Marschner, Alexei Efros

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

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

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

Filters (cont.) CS 554 Computer Vision Pinar Duygulu Bilkent University

Local Features: Detection, Description & Matching

Motion illusion, rotating snakes

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

Feature descriptors. Alain Pagani Prof. Didier Stricker. Computer Vision: Object and People Tracking

SIFT - scale-invariant feature transform Konrad Schindler

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

Line, edge, blob and corner detection

EE795: Computer Vision and Intelligent Systems

Concepts in. Edge Detection

Detection of Edges Using Mathematical Morphological Operators

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

Image features. Image Features

Templates, Image Pyramids, and Filter Banks

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

CAP 5415 Computer Vision Fall 2012

Digital Image Processing (CS/ECE 545) Lecture 5: Edge Detection (Part 2) & Corner Detection

Texture and Other Uses of Filters

Image Processing. Traitement d images. Yuliya Tarabalka Tel.

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

Why is computer vision difficult?

Raghuraman Gopalan Center for Automation Research University of Maryland, College Park

Assignment 3: Edge Detection

Computer Vision. Recap: Smoothing with a Gaussian. Recap: Effect of σ on derivatives. Computer Science Tripos Part II. Dr Christopher Town

Transcription:

Image gradients and edges Thurs Sept 3 Prof. Kristen Grauman UT-Austin Last time Various models for image noise Linear filters and convolution useful for Image smoothing, remov ing noise Box filter Gaussian filter Impact of scale / width of smoothing filter Separable filters more efficient Median filter: a non-linear filter, edge-preserving Image filtering Compute a function of the local neighborhood at each pixel in the image Function specif ied by a f ilter or mask say ing how to combine v alues f rom neighbors. Uses of filtering: Enhance an image (denoise, resize, etc) Extract inf ormation (texture, edges, etc) Detect patterns (template matching) Today Adapted from Derek Hoiem 1

Edge detection Goal: map image f rom 2d array of pixels to a set of curv es or line segments or contours. Why? Figure from J. Shotton et al., PAMI 2007 Main idea: look f or strong gradients, post-process What causes an edge? Reflectance change: appearance information, texture Depth discontinuity: object boundary Cast shadows Change in surface orientation: shape Edges/gradients and invariance 2

Derivatives and edges An edge is a place of rapid change in the image intensity function. image intensity function (along horizontal scanline) first derivative edges correspond to extrema of deriv ativ e Source: L. Lazebnik Derivatives with convolution For 2D f unction, f (x,y), the partial deriv ativ e is: f ( x, y) f ( x, y) f ( x, y) lim x 0 For discrete data, we can approximate using f inite dif f erences: f ( x, y) f ( x 1, y) f ( x, y) x 1 To implement abov e as conv olution, what would be the associated f ilter? Partial derivatives of an image f ( x, y) x -1 1 f ( x, y) y -1 1? or 1-1 Which shows changes with respect to x? (showing filters for correlation) 3

Assorted finite difference filters >> My = fspec ial( s obel ); >> outim = im filter (doub le(im), My) ; >> image sc(ou tim); >> color map g ray; Image gradient The gradient of an image: The gradient points in the direction of most rapid change in intensity The gradient direction (orientation of edge normal) is given by: The edge strength is given by the gradient magnitude Slide credit Steve Seitz Effects of noise Consider a single row or column of the image Plotting intensity as a function of position gives a signal Where is the edge? Slide credit Steve Seitz 4

Solution: smooth first Where is the edge? Derivative theorem of convolution Dif f erentiation property of convolution. Slide credit Steve Seitz Derivative of Gaussian filters ( I g) h I ( g h) 0.0030 0.0133 0.0219 0.0133 0.0030 0.0133 0.0596 0.0983 0.0596 0.0133 0.0219 0.0983 0.1621 0.0983 0.0219 0.0133 0.0596 0.0983 0.0596 0.0133 0.0030 0.0133 0.0219 0.0133 0.0030 1 1 5

Derivative of Gaussian filters x-direction y-direction Source: L. Lazebnik Laplacian of Gaussian Consider Laplacian of Gaussian operator Where is the edge? Slide credit: Steve Seitz 2D edge detection filters Laplacian of Gaussian Gaussian deriv ativ e of Gaussian is the Laplacian operator: Slide credit: Steve Seitz 6

Smoothing with a Gaussian Recall: parameter σ is the scale / width / spread of the Gaussian kernel, and controls the amount of smoothing. Effect of σ on derivatives σ = 1 pixel σ = 3 pixels The apparent structures differ depending on Gaussian s scale parameter. Larger values: larger scale edges detected Smaller values: finer features detected So, what scale to choose? It depends what we re looking f or. 7

Smoothing Values positive Mask properties Sum to 1 constant regions same as input Amount of smoothing proportional to mask size Remove high-frequency components; low-pass filter Derivatives signs used to get high response in regions of high contrast Sum to no response in constant regions High absolute value at points of high contrast Seam carving: main idea Content-aware resizing Intuition: Preserve the most interesting content Pref er to remov e pixels with low gradient energy To reduce or increase size in one dimension, remove irregularly shaped seams Optimal solution v ia dy namic programming. Seam carving: main idea Energy( f ) Want to remove seams w here they w on t be very noticeable: Measure energy as gradient magnitude Choose seam based on minimum total energy path across image, subject to 8-connectedness. 8

Seam carving: algorithm s1 s2 s3 s4 s5 Energy( f ) Let a vertical seam s consist of h positions that form an 8-connected path. Let the cost of a seam be: Cost(s) Optimal seam minimizes this cost: s* min Cost( s) Compute it efficiently w ith dynamic programming. h i1 Energy( f ( )) s s i Seam carving: algorithm Compute the cumulativ e minimum energy f or all possible connected seams at each entry (i,j): M( i, j) Energy ( i, j) min M( i 1, j 1), M( i 1, j), M( i 1, j 1) row i-1 row i j-1 j j+1 j Energy matrix (gradient magnitude) M matrix: cumulativ e min energy (for v ertical seams) Then, min v alue in last row of M indicates end of the minimal connected v ertical seam. Backtrack up f rom there, selecting min of 3 abov e in M. Example M( i, j) Energy ( i, j) min M( i 1, j 1), M( i 1, j), M( i 1, j 1) 1 2 5 3 8 2 0 9 6 1 3 8 3 8 5 0 9 14 Energy matrix (gradient magnitude) M matrix (for v ertical seams) 9

Example M( i, j) Energy ( i, j) min M( i 1, j 1), M( i 1, j), M( i 1, j 1) 1 2 5 3 8 2 0 9 6 1 3 8 3 8 5 0 9 14 Energy matrix (gradient magnitude) M matrix (for v ertical seams) Other notes on seam carving Analogous procedure for horizontal seams Can also insert seams to increase size of image in either dimension Duplicate optimal seam, av eraged with neighbors Other energy functions may be plugged in E.g., color-based, interactiv e, Can use combination of vertical and horizontal seams Gradients -> edges Primary edge detection steps: 1. Smoothing: suppress noise 2. Edge enhancement: filter for contrast 3. Edge localization Determine w hich local maxima from filter output are actually edges vs. noise Threshold, Thin 10

Thresholding Choose a threshold value t Set any pixels less than t to zero (off) Set any pixels greater than or equal to t to one (on) Thresholding gradient with a higher threshold Canny edge detector Filter image with deriv ativ e of Gaussian Find magnitude and orientation of gradient Non-maximum suppression: Thin wide ridges down to single pixel width Linking and thresholding (hysteresis): Def ine two thresholds: low and high Use the high threshold to start edge curv es and the low threshold to continue them MATLAB: edge(image, canny ); >>help edge Source: D. Lowe, L. Fei-Fei 11

The Canny edge detector original image (Lena) Slide credit: Steve Seitz The Canny edge detector thresholding The Canny edge detector How to turn these thick regions of the gradient into curves? thresholding 12

Non-maximum suppression Check if pixel is local maximum along gradient direction, select single max across width of the edge requires checking interpolated pixels p and r The Canny edge detector Problem: pixels along this edge didn t surv iv e the thresholding thinning (non-maximum suppression) Hysteresis thresholding Use a high threshold to start edge curves, and a low threshold to continue them. Source: Steve Seitz 13

Hysteresis thresholding original image high threshold (strong edges) low threshold (weak edges) hysteresis threshold Source: L. Fei-Fei Hysteresis thresholding original image high threshold (strong edges) low threshold (weak edges) hysteresis threshold Source: L. Fei-Fei Recap: Canny edge detector Filter image with deriv ativ e of Gaussian Find magnitude and orientation of gradient Non-maximum suppression: Thin wide ridges down to single pixel width Linking and thresholding (hysteresis): Def ine two thresholds: low and high Use the high threshold to start edge curv es and the low threshold to continue them MATLAB: edge(image, canny ); >>help edge Source: D. Lowe, L. Fei-Fei 14

Low-level edges vs. perceived contours Background Texture Shadows Low-level edges vs. perceived contours image human segmentation gradient magnitude Berkeley segmentation database: http://www.eecs.berkeley.edu/ Res earc h/projects/cs/vision/gr ouping/segbench/ Source: L. Lazebnik Learn from humans which combination of features is most indicative of a good contour? [D. Martin et al. PAMI 2004] Human-marked segment boundaries 15

What features are responsible for perceived edges? Feature profiles (oriented energy, brightness, color, and texture gradients) along the patch s horizontal diameter [D. Martin et al. PAMI 2004] Kristen Grauman, UT-Austin What features are responsible for perceived edges? Feature profiles (oriented energy, brightness, color, and texture gradients) along the patch s horizontal diameter [D. Martin et al. PAMI 2004] Kristen Grauman, UT-Austin [D. Martin et al. PAMI 2004] Kristen Grauman, UT-Austin 16

Contour Detection Canny+opt thresholds Canny Prewitt, Sobel, Roberts Human agreement Learned with combined features UC Berkeley Source: Jitendra Malik: http://www.cs.berkeley.edu/~malik/malik -talks-ptrs.html Computer Vision Group Recall: image filtering Compute a function of the local neighborhood at each pixel in the image Function specif ied by a f ilter or mask say ing how to combine v alues f rom neighbors. Uses of filtering: Enhance an image (denoise, resize, etc) Extract inf ormation (texture, edges, etc) Detect patterns (template matching) Adapted from Derek Hoiem Filters for features Map raw pixels to an intermediate representation that w ill be used for subsequent processing Goal: reduce amount of data, discard redundancy, preserve w hat s useful 17

Template matching Filters as templates: Note that f ilters look like the ef f ects they are intended to f ind --- matched f ilters Use normalized cross-correlation score to f ind a giv en pattern (template) in the image. Normalization needed to control f or relativ e brightnesses. Template matching Scene Template (mask) A toy example Template matching Detected template Correlation map 18

Recap: Mask properties Smoothing Values positive Sum to 1 constant regions same as input Amount of smoothing proportional to mask size Remove high-frequency components; low-pass filter Derivatives Opposite signs used to get high response in regions of high contrast Sum to 0 no response in constant regions High absolute value at points of high contrast Filters act as templates Highest response for regions that look the most like the filter Dot product as correlation Figure from Belongie et al. Chamfer distance Av erage distance to nearest f eature I Set of points in image T Set of points on (shif ted) template d I (t) Minimum distance between point t and some point in I 19

Chamfer distance Chamfer distance Av erage distance to nearest f eature How is the measure different than just filtering with a mask having the shape points? How expensive is a naïve implementation? Edge image Distance transform Image features (2D) Distance Transform 1 0 1 2 3 4 3 2 1 0 1 2 3 3 2 1 1 0 1 2 3 2 1 0 1 0 0 1 2 1 0 1 2 1 1 2 1 0 1 2 3 4 2 3 2 3 2 2 1 1 0 0 1 1 2 2 5 4 4 3 2 1 0 1 Distance Transform is a function D() that for each image pixel p assigns a non-negative number D( p) corresponding to distance from p to the nearest feature in the image I Features could be edge points, foreground points, Source: Yuri Boykov 20

Distance transform original edges distance transform Value at (x,y) tells how far that position is from the nearest edge point (or other binary mage structure) >> help bwdist Distance transform (1D) // 0 if j is in P, infinity otherwise Adapted from D. Huttenlocher Distance Transform (2D) Adapted from D. Huttenlocher 21

Chamfer distance Av erage distance to nearest f eature Edge image Distance transform image Chamfer distance Edge image Distance transform image Fig from D. Gavrila, DAGM 1999 Chamfer distance: properties Sensitive to scale and rotation Tolerant of small shape changes, clutter Need large number of template shapes Inexpensive w ay to match shapes 22

Chamfer matching system Gavrila et al. http://gavrila.net/research/chamfer_system/chamfer_system.html Chamfer matching system Gavrila et al. http://gavrila.net/research/chamfer_system/chamfer_system.html Chamfer matching system Gavrila et al. http://gavrila.net/research/chamfer_system/chamfer_system.html 23

Summary Image gradients Seam carving gradients as energy Gradients edges and contours Template matching Image patch as a filter Chamfer matching Distance transf orm Coming up A1 out, due in 2 weeks Tues: Binary image analysis Guest Lecture : Dr. Danna Gurari Thurs: Images/videos and text Guest Lecture: Prof. Ray Mooney 24