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

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

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

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

Edge Detection CSC 767

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

Image gradients and edges April 11 th, 2017

Image gradients and edges April 10 th, 2018

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

Image gradients and edges

CS5670: Computer Vision

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

Image gradients and edges

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

CS4670: Computer Vision Noah Snavely

Edge and corner detection

Edges and Binary Images

Lecture 6: Edge Detection

Prof. Feng Liu. Winter /15/2019

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

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

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

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

Review of Filtering. Filtering in frequency domain

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

Other Linear Filters CS 211A

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

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

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

Lecture 7: Most Common Edge Detectors

DIGITAL IMAGE PROCESSING

Digital Image Processing. Image Enhancement - Filtering

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

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

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

Edge Detection. EE/CSE 576 Linda Shapiro

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

Local Image preprocessing (cont d)

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

Anno accademico 2006/2007. Davide Migliore

Edges and Binary Image Analysis April 12 th, 2018

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

Practical Image and Video Processing Using MATLAB

Image Analysis. Edge Detection

Filtering Images. Contents

Edge Detection Lecture 03 Computer Vision

Neighborhood operations

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

Digital Image Processing COSC 6380/4393

Comparison between Various Edge Detection Methods on Satellite Image

Filtering in frequency domain

Image Analysis. Edge Detection

Lecture 4: Finding lines: from detection to model fitting

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

Edge detection. Gradient-based edge operators

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.

Straight Lines and Hough

CPSC 425: Computer Vision

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

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

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

CS4442/9542b Artificial Intelligence II prof. Olga Veksler

Lecture: Edge Detection

Image Processing

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

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

Feature Detectors - Canny Edge Detector

Does everyone have an override code?

CS4442/9542b Artificial Intelligence II prof. Olga Veksler

EE795: Computer Vision and Intelligent Systems

Concepts in. Edge Detection

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

Lecture 4: Image Processing

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

Topic 4 Image Segmentation

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

EECS490: Digital Image Processing. Lecture #19

Linear Operations Using Masks

SECTION 5 IMAGE PROCESSING 2

2D Image Processing INFORMATIK. Kaiserlautern University. DFKI Deutsches Forschungszentrum für Künstliche Intelligenz

Biomedical Image Analysis. Point, Edge and Line Detection

Image Processing. Traitement d images. Yuliya Tarabalka Tel.

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

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

EN1610 Image Understanding Lab # 3: Edges

Image Pyramids and Applications

ECG782: Multidimensional Digital Signal Processing

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

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

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

Feature Detectors - Sobel Edge Detector

Segmentation and Grouping

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

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

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

Image features. Image Features

Sobel Edge Detection Algorithm

Image Segmentation Image Thresholds Edge-detection Edge-detection, the 1 st derivative Edge-detection, the 2 nd derivative Horizontal Edges Vertical

Transcription:

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

Last time: Convolution Convolution: Flip the filter in both dimensions (right to left, bottom to top) Then apply cross-correlation G = H F H* H* Notation for convolution operator F K. Grauman

Convolution vs. correlation Convolution G = H F (Cross-)correlation When H is symmetric, no difference. We tend to use the terms interchangeably. Convolution with an impulse (centered at 0,0) is the identity K. Grauman

Filters for features Previously, thinking of filtering as a way to remove or reduce noise Now, consider how filters will allow us to abstract higherlevel features. Map raw pixels to an intermediate representation that will be used for subsequent processing Goal: reduce amount of data, discard redundancy, preserve what s useful K. Grauman

Template matching Filters as templates: Note that filters look like the effects they are intended to find --- matched filters Use (normalized) cross-correlation score to find a given pattern (template) in the image. Normalization needed to control for relative brightness. More in problem sets. K. Grauman

Template matching Template (mask) Scene A toy example K. Grauman

Template matching Template Detected template K. Grauman

Template matching Detected template Correlation map K. Grauman

Where s Waldo? Template Scene K. Grauman

Where s Waldo? Template Detected template K. Grauman

Template demo In directory C:\Bobick\matlab\CS4495\Filter echodemo waldotemplate

Where s Waldo? Detected template Correlation map K. Grauman

Template matching Template Scene What if the template is not identical to some subimage in the scene? K. Grauman

Template matching Template Detected template Match can be meaningful, if scale, orientation, and general appearance is right. K. Grauman

Generic features When looking for a specific object or pattern, the features can be defined for that pattern we will do this later in the course for specific object recognition. But for generic images, what would be good features? What are the parts or properties of the image that encode its meaning for human (or other biological) observers? Some examples of greatly reduced images

Edges seem to be important

Origin of Edges surface normal discontinuity depth discontinuity surface color discontinuity illumination discontinuity Edges are caused by a variety of factors Information theory view: edges encode change, change is what is hard to predict, therefore edges efficiently encode an image

In a real image Reflectance change: appearance information, texture Depth discontinuity: object boundary Cast shadows Change in surface orientation: shape

Contrast and invariance

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

Edge detection How can you tell that a pixel is on an edge?

Images as functions Edges look like steep cliffs

Edge Detection Basic idea: look for a neighborhood with strong signs of change. Problems: neighborhood size 81 82 26 24 82 33 25 25 81 82 26 24 how to detect change

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 derivative Source: L. Lazebnik

Differential Operators Differential operators here we mean some operation that when applied to the image returns some derivatives. We will model these operators as masks/kernels which when applied to the image yields a new function that is the image gradient function. We will then threshold the this gradient function to select the edge pixels. Which brings us to the question: What s a gradient?

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

Discrete gradient For 2D function, f(x,y), the partial derivative is: f ( x, x y) = lim ε 0 f ( x + ε, y) ε ( x, y) For discrete data, we can approximate using finite differences: f f ( x, y) f ( x + 1, y) f ( x, y) x 1 ( 1, ) (, ) f x y f x y + right derivative But is it???

Finite differences Computer Vision - A Modern Approach Set: Linear Filters Slides by D.A. Forsyth

Partial derivatives of an image f ( x, y) x f ( x, y) y -1 1-1 1? or 1-1 Which shows changes with respect to x? (showing correlation filters)

CS 4495 Computer Vision A. Bobick Differentiation and convolution For 2D function, f(x,y), the partial derivative is: For discrete data, we can approximate using finite differences: To implement above as convolution, what would be the associated filter? ε ε ε ), ( ), ( lim ), ( 0 y x f y x f x y x f + = 1 ), ( ) 1, ( ), ( y x f y x f x y x f +

The discrete gradient We want an operator (mask/kernel) that we can apply to the image that implements: f How would you implement this as a cross-correlation? (not flipped) 0 0-1 +1 0 0 ( x, x y) = lim ε 0 f ( x + Not symmetric around image point; which is middle pixel? ε, y) ε f ( x, 0 0 0-1/2 0 +1/2 0 0 0 y) Average of left and right derivative. See?

Example: Sobel operator -1 0 1-2 0 2-1 0 1 1 2 1 0 0 0-1 -2-1 On a pixel of the image I Let g x be the response to mask S x (sometimes * 1/8) Let g y be the response to mask S y What is the gradient? (Sobel) Gradient is I = [g x g y ] T g = (g 2 x + g y2 ) 1/2 θ = atan2(g y, g x ) is the gradient magnitude. is the gradient direction.

Sobel Operator on Blocks Image original image gradient thresholded magnitude gradient magnitude

Some Well-Known Masks for Computing Gradients Sx Sy Sobel: -1 0 1-2 0 2-1 0 1 1 2 1 0 0 0-1 -2-1 Prewitt: -1 0 1-1 0 1-1 0 1 1 1 1 0 0 0-1 -1-1 Roberts 0 1-1 0 1 0 0-1

Matlab does edges >> My = fspecial( sobel ); >> outim = imfilter(double(im), My); >> imagesc(outim); >> colormap gray;

But Consider a single row or column of the image Plotting intensity as a function of x Apply derivative operator. Uh, where s the edge?

Finite differences responding to noise Increasing noise -> (this is zero mean additive gaussian noise) D. Forsyth

Solution: smooth first f h h f ( x h f ) Where is the edge? Look for peaks in ( h x f )

Derivative theorem of convolution This saves us one operation: f x x ( h f) = ( h) f h h x h x ( ) f How can we find (local) maxima of a function?

2 nd derivative of Gaussian Consider f 2 x 2 ( h f ) h x 2 x 2 h Second derivative of Gaussian operator 2 x 2 ( h f ) Where is the edge? Zero-crossings of bottom graph

What about 2D?

Derivative of Gaussian filter ( 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 ] Why is this preferable?

Derivative of Gaussian filters x-direction y-direction Is this for correlation or convolution? And for y it s always a problem! Source: L. Lazebnik

Smoothing with a Gaussian Parameter σ is the scale / width / spread of the Gaussian kernel, and controls the amount of smoothing. for sigma=1:3:10 h = fspecial('gaussian, fsize, sigma); out = imfilter(im, h); imshow(out); pause; end

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 The apparent structures differ depending on Gaussian s scale parameter. Larger values: larger scale edges detected Smaller values: finer features detected σ = 3 pixels

Gradients -> edges Primary edge detection steps: 1. Smoothing: suppress noise 2. Edge enhancement : filter for contrast 3. Edge localization Determine which local maxima from filter output are actually edges vs. noise Threshold, Thin

Canny edge detector Filter image with derivative of Gaussian Find magnitude and orientation of gradient Non-maximum suppression: Thin multi-pixel wide ridges down to single pixel width 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 MATLAB: edge(image, canny ); >>help edge Source: D. Lowe, L. Fei-Fei

The Canny edge detector original image (Lena)

The Canny edge detector magnitude of the gradient

The Canny edge detector thresholding

The Canny edge detector Problem: pixels along this edge didn t survive the thresholding thinning (non-maximum suppression)

The Canny edge detector How to turn these thick regions of the gradient into curves? thresholding

Non-maximum suppression Check if pixel is local maximum along gradient direction can require checking interpolated pixels p and r

The Canny edge detector thinning (non-maximum suppression)

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

So, what scale to choose? It depends what we re looking for. Too fine of a scale can t see the forest for the trees. Too coarse of a scale can t tell the maple grain from the cherry.

Single 2D edge detection filter Laplacian of Gaussian Gaussian derivative of Gaussian is the Laplacian operator: Edge demo in CS4495/Edges

Finish on Thurs