Edge Detection Computer Vision (CS 543 / ECE 549) University of Illinois Derek Hoiem 02/02/12 Many slides from Lana Lazebnik, Steve Seitz, David Forsyth,

Slides:



Advertisements
Similar presentations
CSCE 643 Computer Vision: Template Matching, Image Pyramids and Denoising Jinxiang Chai.
Advertisements

Lecture 2: Convolution and edge detection CS4670: Computer Vision Noah Snavely From Sandlot ScienceSandlot Science.
Motion illusion, rotating snakes. Slide credit Fei Fei Li.
Templates, Image Pyramids, and Filter Banks Slides largely from Derek Hoeim, Univ. of Illinois.
Edge Detection CSE P 576 Larry Zitnick
Templates and Image Pyramids Computational Photography Derek Hoiem, University of Illinois 09/06/11.
Edge and Corner Detection Reading: Chapter 8 (skip 8.1) Goal: Identify sudden changes (discontinuities) in an image This is where most shape information.
Edge Detection. Our goal is to extract a “line drawing” representation from an image Useful for recognition: edges contain shape information –invariance.
Edge detection Goal: Identify sudden changes (discontinuities) in an image Intuitively, most semantic and shape information from the image can be encoded.
Lecture 4 Edge Detection
Edge detection. Edge Detection in Images Finding the contour of objects in a scene.
Announcements Mailing list: –you should have received messages Project 1 out today (due in two weeks)
Lecture 2: Edge detection and resampling
Edge Detection Today’s reading Forsyth, chapters 8, 15.1
Lecture 3: Edge detection, continued
Lecture 2: Image filtering
Edge Detection Today’s readings Cipolla and Gee –supplemental: Forsyth, chapter 9Forsyth Watt, From Sandlot ScienceSandlot Science.
The blue and green colors are actually the same.
CSE 473/573 Computer Vision and Image Processing (CVIP) Ifeoma Nwogu Lecture 10 – Edges and Pyramids 1.
Edge detection Goal: Identify sudden changes (discontinuities) in an image Intuitively, most semantic and shape information from the image can be encoded.
Scale-Invariant Feature Transform (SIFT) Jinxiang Chai.
Computer Vision Spring ,-685 Instructor: S. Narasimhan WH 5409 T-R 10:30 – 11:50am.
Applications of Image Filters Computer Vision CS 543 / ECE 549 University of Illinois Derek Hoiem 02/04/10.
Templates, Image Pyramids, and Filter Banks Computer Vision Derek Hoiem, University of Illinois 01/31/12.
CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.
Lecture 2: Edge detection CS4670: Computer Vision Noah Snavely From Sandlot ScienceSandlot Science.
Templates, Image Pyramids, and Filter Banks
Templates and Image Pyramids Computational Photography Derek Hoiem, University of Illinois 09/03/15.
Image Processing Edge detection Filtering: Noise suppresion.
CS 1699: Intro to Computer Vision Edges and Binary Images Prof. Adriana Kovashka University of Pittsburgh September 15, 2015.
Edge Detection Today’s reading Cipolla & Gee on edge detection (available online)Cipolla & Gee on edge detection From Sandlot ScienceSandlot Science.
Edge Detection Today’s reading Cipolla & Gee on edge detection (available online)Cipolla & Gee on edge detection Szeliski, Ch 4.1.2, From Sandlot.
Instructor: S. Narasimhan
CS654: Digital Image Analysis Lecture 24: Introduction to Image Segmentation: Edge Detection Slide credits: Derek Hoiem, Lana Lazebnik, Steve Seitz, David.
Edge detection Goal: Identify sudden changes (discontinuities) in an image Intuitively, most semantic and shape information from the image can be encoded.
CSE 185 Introduction to Computer Vision Edges. Scale space Reading: Chapter 3 of S.
EE 4780 Edge Detection.
Many slides from Steve Seitz and Larry Zitnick
Templates, Image Pyramids, and Filter Banks
Edge Detection and Geometric Primitive Extraction Jinxiang Chai.
Brent M. Dingle, Ph.D Game Design and Development Program Mathematics, Statistics and Computer Science University of Wisconsin - Stout Edge Detection.
Mestrado em Ciência de Computadores Mestrado Integrado em Engenharia de Redes e Sistemas Informáticos VC 15/16 – TP7 Spatial Filters Miguel Tavares Coimbra.
Announcements Project 0 due tomorrow night. Edge Detection Today’s readings Cipolla and Gee (handout) –supplemental: Forsyth, chapter 9Forsyth For Friday.
Machine Vision Edge Detection Techniques ENT 273 Lecture 6 Hema C.R.
COMPUTER VISION D10K-7C02 CV05: Edge Detection Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
Lecture 8: Edges and Feature Detection
Finding Boundaries Computer Vision CS 143, Brown James Hays 09/28/11 Many slides from Lana Lazebnik, Steve Seitz, David Forsyth, David Lowe, Fei-Fei Li,
Winter in Kraków photographed by Marcin Ryczek
Edge Detection Images and slides from: James Hayes, Brown University, Computer Vision course Svetlana Lazebnik, University of North Carolina at Chapel.
Miguel Tavares Coimbra
Edge Detection slides taken and adapted from public websites:
Image gradients and edges
Edge Detection CS 678 Spring 2018.
Lecture 2: Edge detection
Jeremy Bolton, PhD Assistant Teaching Professor
Edge detection Goal: Identify sudden changes (discontinuities) in an image Intuitively, most semantic and shape information from the image can be encoded.
Edge Detection CSE 455 Linda Shapiro.
Edge Detection Today’s reading
Lecture 2: Edge detection
Oh, no, wait, sorry, I meant, welcome to the implementation of 20th-century science fiction literature, or a small part of it, where we will learn about.
Edge Detection Today’s reading
Edge Detection Today’s readings Cipolla and Gee Watt,
Lecture 2: Edge detection
Winter in Kraków photographed by Marcin Ryczek
IT472 Digital Image Processing
IT472 Digital Image Processing
Edge detection Goal: Identify sudden changes (discontinuities) in an image Intuitively, most semantic and shape information from the image can be encoded.
Templates and Image Pyramids
Edge Detection ECE P 596 Linda Shapiro.
Presentation transcript:

Edge Detection Computer Vision (CS 543 / ECE 549) University of Illinois Derek Hoiem 02/02/12 Many slides from Lana Lazebnik, Steve Seitz, David Forsyth, David Lowe, Fei-Fei Li Magritte, “Decalcomania”

Last class How to use filters for – Matching – Compression Image representation with pyramids Texture and filter banks

A couple remaining questions from earlier Does the curvature of the earth change the horizon location? Illustrations from Amin Sadeghi

A couple remaining questions from earlier Computational complexity of coarse-to-fine search? Image 1 Pyramid Size N Size M Low Resolution Search O(N/M) Repeated Local Neighborhood Search O(M) Downsampling: O(N+M) Image 2 Pyramid Overall complexity: O(N+M) Original high-resolution full search: O(NM) or O(N logN)

Issue from Tuesday Why not use an ideal filter? Attempt to apply ideal filter in frequency domain Answer: has infinite spatial extent, clipping results in ringing

Denoising Additive Gaussian Noise Gaussian Filter

Smoothing with larger standard deviations suppresses noise, but also blurs the image Reducing Gaussian noise Source: S. Lazebnik

Reducing salt-and-pepper noise by Gaussian smoothing 3x35x57x7

Alternative idea: Median filtering A median filter operates over a window by selecting the median intensity in the window Is median filtering linear? Source: K. Grauman

Median filter What advantage does median filtering have over Gaussian filtering? – Robustness to outliers, preserves edges Source: K. Grauman

Median filter Salt-and-pepper noise Median filtered Source: M. Hebert MATLAB: medfilt2(image, [h w])

Median vs. Gaussian filtering 3x35x57x7 Gaussian Median

Other non-linear filters Weighted median (pixels further from center count less) Clipped mean (average, ignoring few brightest and darkest pixels) Max or min filter ( ordfilt2 ) Bilateral filtering (weight by spatial distance and intensity difference) Bilateral filtering

Bilateral filters Edge preserving: weights similar pixels more Carlo Tomasi, Roberto Manduchi, Bilateral Filtering for Gray and Color Images, ICCV, 1998.Bilateral Filtering for Gray and Color Images OriginalGaussian Bilateral spatial similarity (e.g., intensity)

Today’s class Detecting edges Finding straight lines

Why do we care about edges? Extract information, recognize objects Recover geometry and viewpoint Vanishing point Vanishing line Vanishing point Vertical vanishing point (at infinity)

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

Closeup of edges

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 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 Where is the edge? Source: S. Seitz

Effects of noise Difference filters respond strongly to noise – Image noise results in pixels that look very different from their neighbors – Generally, the larger the noise the stronger the response What can we do about it? Source: D. Forsyth

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

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

Derivative of Gaussian filter Is this filter separable? * [1 0 -1] =

Smoothed derivative removes noise, but blurs edge. Also finds edges at different “scales”. 1 pixel3 pixels7 pixels Tradeoff between smoothing and localization Source: D. Forsyth

The gradient magnitude is large along a thick “trail” or “ridge,” so how do we identify the actual edge points? How do we link the edge points to form curves? Implementation issues Source: D. Forsyth

Designing an edge detector Criteria for a good edge detector: – Good detection: the optimal detector should find all real edges, ignoring noise or other artifacts – Good localization the edges detected must be as close as possible to the true edges the detector must return one point only for each true edge point Cues of edge detection – Differences in color, intensity, or texture across the boundary – Continuity and closure – High-level knowledge Source: L. Fei-Fei

Canny edge detector This is 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 signal-to-noise ratio and localization J. Canny, A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis and Machine Intelligence, 8: , 1986.A Computational Approach To Edge Detection Source: L. Fei-Fei

Example input image (“Lena”)

Derivative of Gaussian filter x-direction y-direction

Compute Gradients (DoG) X-Derivative of GaussianY-Derivative of GaussianGradient 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

Bilinear Interpolation

Sidebar: Interpolation options imx2 = imresize(im, 2, interpolation_type) ‘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 Examples from

Before Non-max Suppression

After non-max suppression

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

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

Learning to detect boundaries Berkeley segmentation database: image human segmentation gradient magnitude

pB boundary detector Figure from Fowlkes Martin, Fowlkes, Malik 2004: Learning to Detection Natural Boundaries… S/vision/grouping/papers/mfm-pami-boundary.pdf

pB Boundary Detector Figure from Fowlkes

Brightness Color Texture Combined Human

Results Human (0.95) Pb (0.88)

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

Human (0.95) Pb (0.63)

Human (0.90) Pb (0.35) For more: /CS/vision/bsds/bench/html/ color.html /CS/vision/bsds/bench/html/ color.html

Global pB boundary detector Figure from Fowlkes

State of edge detection Local edge detection is mostly solved – Intensity gradient, color, texture Some methods to take into account longer contours, but could probably do better Poor use of object and high-level information

Finding straight lines Another solution: get connected components of pixels and check for straightness

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) 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 5.Threshold on straightness, store segment Larger eigenvector

2. Canny lines  …  straight edges

Homework 1 Due Feb 14, but try to finish by Tues (HW 2 will take quite a bit more time)

Things to remember Canny edge detector = smooth  derivative  thin  threshold  link Pb: learns weighting of gradient, color, texture differences Straight line detector = canny + gradient orientations  orientation binning  linking  check for straightness

Next classes: Correspondence and Alignment Detecting interest points Tracking points Object/image alignment and registration – Aligning 3D or edge points – Object instance recognition – Image stitching

Finding straight lines One solution: try many possible lines and see how many points each line passes through Hough transform provides a fast way to do this

Outline of Hough Transform 1.Create a grid of parameter values 2.Each point votes for a set of parameters, incrementing those values in grid 3.Find maximum or local maxima in grid

Finding lines using Hough transform Using m,b parameterization Using r, theta parameterization – Using oriented gradients Practical considerations – Bin size – Smoothing – Finding multiple lines – Finding line segments

1. Image  Canny

2. Canny  Hough votes

3. Hough votes  Edges Find peaks and post-process

Hough transform example

Hough transform examples OpenCV: probabilistic hough transform

Finding circles using Hough transform Fixed r Variable r

Hough Transform Method Comparison Connected Components Method