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

Similar documents
Review of Filtering. Filtering in frequency domain

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

DIGITAL IMAGE PROCESSING

Edges and Binary Images

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 Detection CSC 767

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

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

CS5670: Computer Vision

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

Straight Lines and Hough

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

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

Edge and corner detection

Filtering in frequency domain

Does everyone have an override code?

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

CS4670: Computer Vision Noah Snavely

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

Edge Detection. EE/CSE 576 Linda Shapiro

Prof. Feng Liu. Winter /15/2019

Lecture 7: Most Common Edge Detectors

Boundaries and Sketches

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

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

Image gradients and edges

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

Edges and Binary Image Analysis April 12 th, 2018

Image Analysis. Edge Detection

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

Lecture 4: Finding lines: from detection to model fitting

Image gradients and edges April 11 th, 2017

Image gradients and edges April 10 th, 2018

Image Analysis. Edge Detection

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

Digital Image Processing COSC 6380/4393

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

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

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

Image gradients and edges

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

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

Lecture 6: Edge Detection

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

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

Image Processing

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

Local Image preprocessing (cont d)

CS 558: Computer Vision 3 rd Set of Notes

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

Epipolar Geometry and Stereo Vision

Digital Image Processing. Image Enhancement - Filtering

EE795: Computer Vision and Intelligent Systems

Other Linear Filters CS 211A

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

Anno accademico 2006/2007. Davide Migliore

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

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)

Comparison between Various Edge Detection Methods on Satellite Image

Local Image Features

CS 4495 Computer Vision A. Bobick. CS 4495 Computer Vision. Features 2 SIFT descriptor. Aaron Bobick School of Interactive Computing

Feature Tracking and Optical Flow

Topic 4 Image Segmentation

Feature Descriptors. CS 510 Lecture #21 April 29 th, 2013

Edge Detection Lecture 03 Computer Vision

Motion illusion, rotating snakes

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

Biomedical Image Analysis. Point, Edge and Line Detection

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

Part III: Affinity Functions for Image Segmentation

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

Local Image Features

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

CS 558: Computer Vision 4 th Set of Notes

Computer Vision I - Basics of Image Processing Part 2

Why is computer vision difficult?

EN1610 Image Understanding Lab # 3: Edges

High Level Computer Vision. Basic Image Processing - April 26, 2o17. Bernt Schiele - Mario Fritz -

School of Computing University of Utah

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

Feature Tracking and Optical Flow

The SIFT (Scale Invariant Feature

Deformable Part Models

Practical Image and Video Processing Using MATLAB

Image Pyramids and Applications

Local Features: Detection, Description & Matching

ECE Digital Image Processing and Introduction to Computer Vision

Peripheral drift illusion

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

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

Feature Matching and Robust Fitting

Lecture 10 Detectors and descriptors

Grouping and Segmentation

Applications of Image Filters

Object Category Detection. Slides mostly from Derek Hoiem

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

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

CPSC 425: Computer Vision

Transcription:

Edge Detection Computer Vision Shiv Ram Dubey, IIIT Sri City

Previous two classes: Image Filtering Spatial domain Smoothing, sharpening, measuring texture * = FFT FFT Inverse FFT = Frequency domain Denoising, sampling

Today s class Detecting edges Finding straight lines

Why finding edges is important? Cues for 3D shape Group pixels into objects or parts Shape analysis Recover geometry and viewpoint Vanishing line Vanishing point Vertical vanishing point (at infinity) Vanishing point

Origin of Edges surface normal discontinuity depth discontinuity surface color discontinuity illumination discontinuity Edges are caused by a variety of factors Source: Steve Seitz

Closeup of edges

Closeup of edges

Closeup of edges

Closeup of edges

Closeup of edges

Closeup of edges

Characterizing edges An edge is a place of rapid change in the image intensity function image

Characterizing edges An edge is a place of rapid change in the image intensity function image intensity function (along horizontal scanline)

Characterizing edges An edge is a place of rapid change in the image intensity function image intensity function (along horizontal scanline) first derivative

Characterizing 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 derivative

Intensity profile

Intensity profile Intensity

Intensity profile Intensity Gradient

With a little Gaussian noise Gradient

Effects of noise Consider a single row or column of the image Plotting intensity as a function of position gives a signal Source: S. 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? Source: S. 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? The larger the noise the stronger the response

Effects of noise Consider a single row or column of the image Plotting intensity as a function of position gives a signal What can we do about it?

Solution: smooth first f Source: S. Seitz

Solution: smooth first f g Source: S. Seitz

Solution: smooth first f g f * g Source: S. Seitz

Solution: smooth first f g f * g d dx ( f g) To find edges, look for peaks in ( f g) d dx Source: S. Seitz

Derivative theorem of convolution Differentiation is convolution, and convolution is associative: d ( f g) f This saves us one operation: dx d dx g f d dx g f d dx g Source: S. Seitz

Gaussian Kernel Source: C. Rasmussen

Gaussian filters = 1 pixel = 5 pixels = 10 pixels = 30 pixels

Derivative of Gaussian filter * [1 0-1] = Gaussian derivative of Gaussian (x)

Derivative of Gaussian filter x-direction y-direction

Designing an edge detector Criteria for a good edge detector: Good detection: find all real edges, ignoring noise or other artifacts Source: L. Fei-Fei

Designing an edge detector Criteria for a good edge detector: Good detection: find all real edges, ignoring noise or other artifacts Good localization detect edges as close as possible to the true edges return one point only for each true edge point Source: L. Fei-Fei

Canny edge detector The most widely used edge detector J. Canny, A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis and Machine Intelligence, 8:679-714, 1986.

Example input image ( Lena )

Derivative of Gaussian filter x-direction y-direction

Compute Gradients (DoG) Input Image X-Derivative of Gaussian

Compute Gradients (DoG) Input Image X-Derivative of Gaussian Y-Derivative of Gaussian

Compute Gradients (DoG) Input Image X-Derivative of Gaussian Y-Derivative of Gaussian Gradient Magnitude

Get Orientation at Each Pixel Threshold at minimum level Get orientation theta = atan2(gy, gx)

Non-maximum suppression for each orientation At q, we have a maximum if the value is larger than those at both p and at r. Interpolate to get these values. Source: D. Forsyth

Examples from http://en.wikipedia.org/wiki/bicubic_interpolation Sidebar: Interpolation options nearest Copy value from nearest known Very fast but creates blocky edges bilinear Weighted average from four nearest known pixels Fast and reasonable results bicubic (default) Non-linear smoothing over larger area Slower, visually appealing, may create negative pixel values

Before Non-max Suppression

After non-max suppression

Hysteresis thresholding Threshold at low/high levels to get weak/strong edge pixels Do connected components, starting from strong edge pixels

Hysteresis thresholding Check that maximum value of gradient value is sufficiently large drop-outs? use hysteresis use a high threshold to start edge curves and a low threshold to continue them. Source: S. Seitz

Final Canny Edges

Canny edge detector 1. Filter image with x, y derivatives of Gaussian 2. Find magnitude and orientation of gradient 3. Non-maximum suppression: Thin multi-pixel wide ridges down to single pixel width 4. Thresholding and linking (hysteresis): Define two thresholds: low and high Use the high threshold to start edge curves and the low threshold to continue them MATLAB: edge(image, canny ) Source: D. Lowe, L. Fei-Fei

Canny edge detector 1. Filter image with x, y derivatives of Gaussian 2. Find magnitude and orientation of gradient 3. Non-maximum suppression: Thin multi-pixel wide ridges down to single pixel width 4. Thresholding and linking (hysteresis): Define two thresholds: low and high Use the high threshold to start edge curves and the low threshold to continue them MATLAB: edge(image, canny ) Source: D. Lowe, L. Fei-Fei

Canny edge detector 1. Filter image with x, y derivatives of Gaussian 2. Find magnitude and orientation of gradient 3. Non-maximum suppression: Thin multi-pixel wide ridges down to single pixel width 4. Thresholding and linking (hysteresis): Define two thresholds: low and high Use the high threshold to start edge curves and the low threshold to continue them MATLAB: edge(image, canny ) Source: D. Lowe, L. Fei-Fei

Canny edge detector 1. Filter image with x, y derivatives of Gaussian 2. Find magnitude and orientation of gradient 3. Non-maximum suppression: Thin multi-pixel wide ridges down to single pixel width 4. Thresholding and linking (hysteresis): Define two thresholds: low and high Use the high threshold to start edge curves and the low threshold to continue them MATLAB: edge(image, canny ) Source: D. Lowe, L. Fei-Fei

Canny edge detector 1. Filter image with x, y derivatives of Gaussian 2. Find magnitude and orientation of gradient 3. Non-maximum suppression: Thin multi-pixel wide ridges down to single pixel width 4. Thresholding and linking (hysteresis): Define two thresholds: low and high Use the high threshold to start edge curves and the low threshold to continue them MATLAB: edge(image, canny ) Source: D. Lowe, L. Fei-Fei

Effect of (Gaussian kernel spread/size) original Canny with Canny with The choice of depends on desired behavior large detects large scale edges small detects fine features Source: S. Seitz

Learning to detect boundaries image human segmentation gradient magnitude Berkeley segmentation database: http://www.eecs.berkeley.edu/research/projects/cs/vision/grouping/segbench/

Pb Boundary Detector Martin, Fowlkes, Malik 2004: Learning to Detection Natural Boundaries Figure from Fowlkes

Pb Boundary Detector I-Intensity, B-Brightness gradient, C-Color gradient, T-Texture gradient Figure from Fowlkes

Brightness Color Texture Combined Human

Results Pb (0.88) Human (0.95)

Results Pb Global Pb (0.88) Pb Human Human (0.96)

Results Pb (0.63) Human (0.95)

Results Pb (0.35) Human (0.90) For more: http://www.eecs.berkeley.edu/research/projects/cs /vision/bsds/bench/html/108082-color.html

Global Pb Boundary Detector Figure from Fowlkes

Edge Detection with Structured Random Forests (Dollar and Zitnick ICCV 2013) Goal: quickly predict whether each pixel is an edge Insights Predictions can be learned from training data Predictions for nearby pixels should not be independent Solution Train structured random forests to split data into patches with similar boundaries based on features Predict boundaries at patch level, rather than pixel level, and aggregate (average votes) Boundaries in patch http://research.microsoft.com/pubs/202540/dollariccv13edges.pdf

Edge Detection with Structured Random Forests - Algorithm 1. Extract overlapping 32x32 patches at three scales 2. Features are pixel values and pairwise differences in feature maps (color, gradient magnitude, oriented gradient) 3. Predict T boundary maps in the central 16x16 region using T trained decision trees 4. Average predictions for each pixel across all patches

Edge Detection with Structured Random Forests Ground truth Results

DeepContour Shen et al., Deep Contour, CVPR 2015

DeepContour Shen et al., Deep Contour, CVPR 2015

Holistically-Nested Edge Detection: Using Convolution Xie and Tu, Holistically-Nested Edge Detection, ICCV 2015

Holistically-Nested Edge Detection: Using Convolution Xie and Tu, Holistically-Nested Edge Detection, ICCV 2015

State of edge detection Local edge detection is mostly solved Intensity gradient, color, texture Often used in combination with object detectors or region classifiers Deep learning approach is more common nowadays

Finding straight lines

Finding line segments using connected components 1. Compute canny edges Compute: gx, gy (DoG in x,y directions) Compute: theta = atan(gy / gx)

Finding line segments using connected components 1. Compute canny edges Compute: gx, gy (DoG in x,y directions) Compute: theta = atan(gy / gx) 2. Assign each edge to one of 8 directions

Finding line segments using connected components 1. Compute canny edges Compute: gx, gy (DoG in x,y directions) Compute: theta = atan(gy / gx) 2. Assign each edge to one of 8 directions 3. For each direction d, get edgelets: find connected components for edge pixels with directions in {d-1, d, d+1}

Finding line segments using connected components 1. Compute canny edges Compute: gx, gy (DoG in x,y directions) Compute: theta = atan(gy / gx) 2. Assign each edge to one of 8 directions 3. For each direction d, get edgelets: find connected components for edge pixels with directions in {d-1, d, d+1} 4. Compute straightness and theta of edgelets using eig of x,y 2 nd moment matrix of their points

Finding line segments using connected components 1. Compute canny edges Compute: gx, gy (DoG in x,y directions) Compute: theta = atan(gy / gx) 2. Assign each edge to one of 8 directions 3. For each direction d, get edgelets: find connected components for edge pixels with directions in {d-1, d, d+1} 4. Compute straightness and theta of edgelets using eig of x,y 2 nd moment matrix of their points M 2 x x x x y y 2 x x y y y y [ v, λ] eig( Μ) Larger eigenvector atan 2( v(2,2), v(1,2)) conf 2 / 1

Finding line segments using connected components 1. Compute canny edges Compute: gx, gy (DoG in x,y directions) Compute: theta = atan(gy / gx) 2. Assign each edge to one of 8 directions 3. For each direction d, get edgelets: find connected components for edge pixels with directions in {d-1, d, d+1} 4. Compute straightness and theta of edgelets using eig of x,y 2 nd moment matrix of their points M 2 x x x x y y 2 x x y y y y [ v, λ] eig( Μ) Larger eigenvector atan 2( v(2,2), v(1,2)) conf 2 / 1 5. Threshold on straightness, store segment

Canny lines straight edges

Things to remember Canny edge detector = smooth derivative thin threshold link Pb: learns weighting of gradient, color, texture differences More recent learning approaches give at least as good accuracy and are faster Straight line detector = canny + gradient orientations orientation binning linking check for straightness

Acknowledgements Thanks to the following researchers for making their teaching/research material online Forsyth Steve Seitz Noah Snavely J.B. Huang Derek Hoiem D. Lowe A. Bobick S. Lazebnik K. Grauman R. Zaleski

Next classes: Correspondence and Alignment Detecting interest points Tracking points Object/image alignment and registration Image stitching