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

Similar documents
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

Other Linear Filters CS 211A

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

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

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

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

Anno accademico 2006/2007. Davide Migliore

Edge Detection. EE/CSE 576 Linda Shapiro

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

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

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

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

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

CS5670: Computer Vision

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

An edge is not a line... Edge Detection. Finding lines in an image. Finding lines in an image. How can we detect lines?

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

Lecture 7: Most Common Edge Detectors

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

Edge and corner detection

Edge detection. Gradient-based edge operators

CS4670: Computer Vision Noah Snavely

Generalized Hough Transform, line fitting

Image Processing

Edge Detection CSC 767

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

Lecture 4: Finding lines: from detection to model fitting

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

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

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

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

Lecture 9: Hough Transform and Thresholding base Segmentation

Types of Edges. Why Edge Detection? Types of Edges. Edge Detection. Gradient. Edge Detection

Lesson 6: Contours. 1. Introduction. 2. Image filtering: Convolution. 3. Edge Detection. 4. Contour segmentation

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

Prof. Feng Liu. Winter /15/2019

Lecture 6: Edge Detection

Biomedical Image Analysis. Point, Edge and Line Detection

Straight Lines and Hough

Digital Image Processing. Image Enhancement - Filtering

Local Image preprocessing (cont d)

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

Announcements. Hough Transform [ Patented 1962 ] Generalized Hough Transform, line fitting. Assignment 2: Due today Midterm: Thursday, May 5 in class

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

Lecture 8: Fitting. Tuesday, Sept 25

Edge Detection Lecture 03 Computer Vision

Image gradients and edges April 11 th, 2017

Image gradients and edges April 10 th, 2018

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

DIGITAL IMAGE PROCESSING

Digital Image Processing COSC 6380/4393

EE795: Computer Vision and Intelligent Systems

Image Analysis. Edge Detection

Model Fitting. Introduction to Computer Vision CSE 152 Lecture 11

Segmentation (Part 2)

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

Edge Detection. CMPUT 206: Introduction to Digital Image Processing. Nilanjan Ray. Source:

Capturing, Modeling, Rendering 3D Structures

Fitting: Voting and the Hough Transform April 23 rd, Yong Jae Lee UC Davis

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

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

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

Feature Detectors and Descriptors: Corners, Lines, etc.

Image gradients and edges

Filtering Images. Contents

E0005E - Industrial Image Analysis

Edges and Binary Images

Announcements. Segmentation (Part 2) Image Segmentation. From images to objects. Image histograms. What do histograms look like?

Outlines. Medical Image Processing Using Transforms. 4. Transform in image space

Edges and Lines Readings: Chapter 10: better edge detectors line finding circle finding

Image features. Image Features

Image gradients and edges

Neighborhood operations

Edges and Lines Readings: Chapter 10: better edge detectors line finding circle finding

Computer Vision: 4. Filtering. By I-Chen Lin Dept. of CS, National Chiao Tung University

Advanced Video Content Analysis and Video Compression (5LSH0), Module 4

Image Understanding Edge Detection

Image Processing. Traitement d images. Yuliya Tarabalka Tel.

Lecture: Edge Detection

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

Comparison between Various Edge Detection Methods on Satellite Image

Image Analysis. Edge Detection

Example 1: Regions. Image Segmentation. Example 3: Lines and Circular Arcs. Example 2: Straight Lines. Region Segmentation: Segmentation Criteria

Example 2: Straight Lines. Image Segmentation. Example 3: Lines and Circular Arcs. Example 1: Regions

Review of Filtering. Filtering in frequency domain

Segmentation and Grouping

Review for the Final

Feature extraction. Bi-Histogram Binarization Entropy. What is texture Texture primitives. Filter banks 2D Fourier Transform Wavlet maxima points

Lecture 15: Segmentation (Edge Based, Hough Transform)

Fitting. Lecture 8. Cristian Sminchisescu. Slide credits: K. Grauman, S. Seitz, S. Lazebnik, D. Forsyth, J. Ponce

School of Computing University of Utah

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

HOUGH TRANSFORM CS 6350 C V

Line, edge, blob and corner detection

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

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

Finding 2D Shapes and the Hough Transform

Introduction to Medical Imaging (5XSA0)

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

Transcription:

Multimedia Computing: Algorithms, Systems, and Applications: Edge Detection By Dr. Yu Cao Department of Computer Science The University of Massachusetts Lowell Lowell, MA 01854, USA Part of the slides were adopted from Dr. A. Hanson, Dr. Z.G. Zhu, Dr. S. Thrun, Dr. M. Pollefeys, A. Baraniecki, Wikipedia, and etc. The copyright of those parts belongs to the original authors. 1 Linear Filters General process: Form new image whose pixels are a weighted sum of original pixel values, using the same set of weights at each point. Properties Output is a linear function of the input Output is a shift-invariant function of the input (i.e. shift the input image two pixels to the left, the output is shifted two pixels to the left) Example: smoothing by averaging form the average of pixels in a neighbourhood Example: smoothing with a Gaussian form a weighted average of pixels in a neighbourhood Example: finding a derivative form a weighted average of pixels in a neighbourhood 2 1

Convolution Represent these weights as an image, H H is usually called the kernel Operation is called convolution it s associative Result is: R ij = u,v H i u,j v F uv Notice wierd order of indices all examples can be put in this form it s a result of the derivation expressing any shiftinvariant linear operator as a convolution. 3 Convolution f(.) f(.) f(.) f(.) f(.) f(.) f(.) f(.) f(.) c 11 c 21 c31 c 12 c22 c32 c 13 c 23 c 33 o (i,j) = c 11 f(i-1,j-1) c21 f(i,j-1) + c 12 f(i-1,j) + c 22 f(i,j) + c 13 f(i-1,j+1) + + c 23 f(i,j+1) + c 31 f(i+1,j-1) + c 32 f(i+1,j) + c 33 f(i+1,j+1) 4 2

Example: Smoothing by Averaging 5 Smoothing with a Gaussian Smoothing with an average actually doesn t compare at all well with a defocussed lens Most obvious difference is that a single point of light viewed in a defocussed lens looks like a fuzzy blob; but the averaging process would give a little square. A Gaussian gives a good model of a fuzzy blob 6 3

An Isotropic Gaussian The picture shows a smoothing kernel proportional to exp x2 + y 2 2σ 2 (which is a reasonable model of a circularly symmetric fuzzy blob) 7 Smoothing with a Gaussian 8 4

Edge detection Convert a 2D image into a set of curves Extracts salient features of the scene More compact than pixels 9 Origin of Edges surface normal discontinuity depth discontinuity surface color discontinuity illumination discontinuity Edges are caused by a variety of factors 10 5

Edge detection How can you tell that a pixel is on an edge? 11 Edge is Where Change Occurs Change is measured by derivative in 1D Biggest change, derivative has maximum magnitude Or 2 nd derivative is zero. 12 6

Image gradient The gradient of an image: The gradient points in the direction of most rapid change 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 13 The discrete gradient How can we differentiate a digital image f[x,y]? Option 1: reconstruct a continuous image, then take gradient Option 2: take discrete derivative (finite difference) How would you implement this as a cross-correlation? 14 7

The Sobel operator Better approximations of the derivatives exist The Sobel operators below are very commonly used -1 0 1-2 0 2-1 0 1 1 2 1 0 0 0-1 -2-1 The standard definition of the Sobel operator omits the 1/8 term doesn t make a difference for edge detection the 1/8 term is needed to get the right gradient value, however 15 Gradient operators (a): Roberts cross operator (b): 3x3 Prewitt operator (c): Sobel operator (d) 4x4 Prewitt operator 16 8

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? 17 Solution: smooth first Where is the edge? Look for peaks in 18 9

Derivative theorem of convolution This saves us one operation: 19 Laplacian of Gaussian Consider Laplacian of Gaussian operator Where is the edge? Zero-crossings of bottom graph 20 10

2D edge detection filters Laplacian of Gaussian Gaussian derivative of Gaussian is the Laplacian operator: 21 Optimal Edge Detection: Canny Assume: Linear filtering Additive iid Gaussian noise Edge detector should have: Good Detection. Filter responds to edge, not noise. Good Localization: detected edge near true edge. Single Response: one per edge. 22 11

Optimal Edge Detection: Canny (continued) Optimal Detector is approximately Derivative of Gaussian. Detection/Localization trade-off More smoothing improves detection And hurts localization. This is what you might guess from (detect change) + (remove noise) 23 The Canny edge detector original image (Lena) 24 12

The Canny edge detector norm of the gradient 25 The Canny edge detector thresholding 26 13

The Canny edge detector thinning (non-maximum suppression) 27 Non-maximum suppression We wish to mark points along the curve where the magnitude is biggest. We can do this by looking for a maximum along a slice normal to the curve (non-maximum suppression). These points should form a curve. There are then two algorithmic issues: At which point is the maximum Where is the next point? 28 14

Non-maximum suppression (Issue 1): At which point is the maximum Check if pixel is local maximum along gradient direction requires checking interpolated pixels p and r 29 Non-maximum suppression (Issue 2): Where is the next one Predicting the next edge point 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). 30 15

Hysteresis (eliminating streaking ) Streaking The breaking up of an edge contour caused by the operator output fluctuating above and below the threshold. Using two thresholds High threshold T1 Low threshold T2 Algorithm Any pixel in the image that has a value greater than T1 is presumed to be an edge pixel, and is marked as such immediately. Any pixels that are connected to this edge pixel and that have a value greater than T2 are also selected as edge pixels 31 Hysteresis (eliminating streaking ) Algorithm Any pixel in the image that has a value greater than T1 is presumed to be an edge pixel, and is marked as such immediately. Any pixels that are connected to this edge pixel and that have a value greater than T2 are also selected as edge pixels Canny Edge Detection Demo: http://www.cs.washington.edu/research/imagedatabase/demo/edge/ 32 16

Effect of σ (Gaussian kernel size) original Canny with Canny with The choice of large small depends on desired behavior detects large scale edges detects fine features 33 Scale Smoothing Eliminates noise edges. Makes edges smoother. Removes fine detail. (Forsyth & Ponce) 34 17

35 fine scale high threshold 36 18

coarse scale, high threshold 37 coarse scale low threshold 38 19

Scale space (Witkin 83) first derivative peaks larger Gaussian filtered signal Properties of scale space (w/ Gaussian smoothing) edge position may shift with increasing scale (σ) two edges may merge with increasing scale an edge may not split into two with increasing scale 39 Edge detection by subtraction original 40 20

Edge detection by subtraction smoothed (5x5 Gaussian) 41 Edge detection by subtraction Why does this work? smoothed original (scaled by 4, offset +128) 42 21

Gaussian - image filter Gaussian delta function Laplacian of Gaussian 43 An edge is not a line... How can we detect lines? 44 22

Finding lines in an image Option 1: Search for the line at every possible position/orientation What is the cost of this operation? Option 2: Use a voting scheme: Hough transform 45 Finding lines in an image y b b 0 image space x m 0 Hough space m Connection between image (x,y) and Hough (m,b) spaces A line in the image corresponds to a point in Hough space To go from image space to Hough space: given a set of points (x,y), find all (m,b) such that y = mx + b 46 23

Finding lines in an image y b y 0 x 0 x image space Hough space Connection between image (x,y) and Hough (m,b) spaces A line in the image corresponds to a point in Hough space To go from image space to Hough space: given a set of points (x,y), find all (m,b) such that y = mx + b What does a point (x 0, y 0 ) in the image space map to? m A: the solutions of b = -x 0 m + y 0 this is a line in Hough space 47 Hough transform algorithm Typically use a different parameterization d is the perpendicular distance from the line to the origin θ is the angle this perpendicular makes with the x axis Why? cosθ d y = x + sinθ sinθ y d θ x 48 24

Hough transform algorithm Typically use a different parameterization d is the perpendicular distance from the line to the origin θ is the angle this perpendicular makes with the x axis Why? Basic Hough transform algorithm 1. Initialize H[d, θ]=0 2. for each edge point I[x,y] in the image for θ = 0 to 180 If H[d, θ] += 1 3. Find the value(s) of (d, θ) where H[d, θ] is maximum 4. The detected line in the image is given by What s the running time (measured in # votes)? 49 Extensions Extension 1: Use the image gradient 1. same 2. for each edge point I[x,y] in the image compute unique (d, θ) based on image gradient at (x,y) H[d, θ] += 1 3. same 4. same 1. What s the running time measured in votes? 50 25

Extensions Extension 1: Use the image gradient 1. same 2. for each edge point I[x,y] in the image compute unique (d, θ) based on image gradient at (x,y) H[d, θ] += 1 3. same 4. same 1. What s the running time measured in votes? 2. Extension 2 give more votes for stronger edges Extension 3 change the sampling of (d, θ) to give more/less resolution Extension 4 The same procedure can be used with circles, squares, or any other shape 51 Hough Transform for Curves The H.T. can be generalized to detect any curve that can be expressed in parametric form: Y = f(x, a1,a2, ap) a1, a2, ap are the parameters The parameter space is p-dimensional The accumulating array is LARGE! 52 26

H.T. Summary H.T. is a voting scheme points vote for a set of parameters describing a line or curve. The more votes for a particular set the more evidence that the corresponding curve is present in the image. Can detect MULTIPLE curves in one shot. Computational cost increases with the number of parameters describing the curve. 53 Corner detection Corners contain more edges than lines. A point on a line is hard to match. 54 27

Corners contain more edges than lines. A corner is easier 55 Edge Detectors Tend to Fail at Corners 56 28

Finding Corners Intuition: Right at corner, gradient is ill defined. Near corner, gradient has two different values. 57 Formula for Finding Corners We look at matrix: Sum over a small region, the hypothetical corner C = I I x 2 x I y Gradient with respect to x, times gradient with respect to y I I x y 2 I y Matrix is symmetric WHY THIS? 58 29

C First, consider case where: = I I x 2 x I y I I x y 2 I y λ1 = 0 This means all gradients in neighborhood are: 0 λ 2 (k,0) or (0, c) or (0, 0) (or off-diagonals cancel). What is region like if: 1. λ1 = 0? 2. λ2 = 0? 3. λ1 = 0 and λ2 = 0? 4. λ1 > 0 and λ2 > 0? 59 General Case: From Linear Algebra, it follows that because C is symmetric: C λ = R 1 0 1 R 0 λ2 With R a rotation matrix. So every case is like one on last slide. 60 30

So, to detect corners Filter image. Compute magnitude of the gradient everywhere. We construct C in a window. Use Linear Algebra to find λ1 and λ2. If they are both big, we have a corner. 61 Questions? 62 31