Image gradients and edges

Similar documents
Image gradients and edges April 10 th, 2018

Image gradients and edges April 11 th, 2017

Image gradients and edges

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)

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

Edges and Binary Images

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

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

Lecture 6: Edge Detection

Review of Filtering. Filtering in frequency domain

Edge and corner detection

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

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

CS4670: Computer Vision Noah Snavely

Does everyone have an override code?

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

Edges and Binary Image Analysis April 12 th, 2018

CS5670: Computer Vision

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

[ ] 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

Digital Image Processing. Image Enhancement - Filtering

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

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

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

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

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

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

Image Analysis. Edge Detection

Edge Detection. EE/CSE 576 Linda Shapiro

Image processing. Reading. What is an image? Brian Curless CSE 457 Spring 2017

DIGITAL IMAGE PROCESSING

Image Analysis. Edge Detection

CS4442/9542b Artificial Intelligence II prof. Olga Veksler

Why is computer vision difficult?

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

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

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

CS4442/9542b Artificial Intelligence II prof. Olga Veksler

Applications of Image Filters

EECS 556 Image Processing W 09. Image enhancement. Smoothing and noise removal Sharpening filters

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

Other Linear Filters CS 211A

Lecture 4: Spatial Domain Transformations

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

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

Anno accademico 2006/2007. Davide Migliore

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

Chapter 3: Intensity Transformations and Spatial Filtering

Lecture 4: Image Processing

Edge detection. Gradient-based edge operators

EE795: Computer Vision and Intelligent Systems

Lecture 4: Finding lines: from detection to model fitting

Texture Representation + Image Pyramids

Digital Image Processing COSC 6380/4393

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

Lecture 7: Most Common Edge Detectors

SYDE 575: Introduction to Image Processing

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

Edge Detection Lecture 03 Computer Vision

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

Image warping and stitching

Texture and Other Uses of Filters

Image Processing. Traitement d images. Yuliya Tarabalka Tel.

Filtering Images. Contents

Bias-Variance Trade-off (cont d) + Image Representations

Digital Image Processing. Prof. P. K. Biswas. Department of Electronic & Electrical Communication Engineering

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

Segmentation and Grouping April 21 st, 2015

Sharpening through spatial filtering

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

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

Segmentation and Grouping

Computer Vision and Graphics (ee2031) Digital Image Processing I

Straight Lines and Hough

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

Segmentation and Grouping April 19 th, 2018

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

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

EECS490: Digital Image Processing. Lecture #19

Stereo. Outline. Multiple views 3/29/2017. Thurs Mar 30 Kristen Grauman UT Austin. Multi-view geometry, matching, invariant features, stereo vision

CS 558: Computer Vision 3 rd Set of Notes

Image warping and stitching

Linear Operations Using Masks

Texture April 14 th, 2015

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

CPSC 425: Computer Vision

Fitting a transformation: Feature-based alignment April 30 th, Yong Jae Lee UC Davis

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

Image Processing

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

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

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

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

EEM 463 Introduction to Image Processing. Week 3: Intensity Transformations

Transcription:

Image gradients and edges April 7 th, 2015 Yong Jae Lee UC Davis

Announcements PS0 due this Friday Questions? 2

Last time Image formation Linear filters and convolution useful for Image smoothing, removing noise Box filter Gaussian filter Impact of scale / width of smoothing filter Separable filters more efficient Median filter: a non-linear filter, edge-preserving 3 Slide adapted from Kristen Grauman

Review Filter f = 1/9 x [ 1 1 1 1 1 1 1 1 1] f*g=? original image g filtered 4

Review Filter f = 1/9 x [ 1 1 1 1 1 1 1 1 1] T f*g=? original image g filtered 5

Review How do you sharpen an image? 6 Slide credit: Devi Parikh

Practice with linear filters 0 0 0 0 2 0 0 0 0-1 1 1 1 1 1 1 1 1 Original Sharpening filter: accentuates differences with local average 7 Slide credit: David Lowe

Filtering examples: sharpening 8

Sharpening revisited What does blurring take away? = original Let s add it back: smoothed (5x5) detail + α = Slide credit: Svetlana Lazebnik original detail sharpened

Unsharp mask filter f + α( f f g) = (1 + α) f α f g = f ((1 + α) e g) image blurred image unit impulse (identity) unit impulse Gaussian Laplacian of Gaussian Slide credit: Svetlana Lazebnik

Review Median filter f: Is f(a+b) = f(a)+f(b)? Example: a = [10 20 30 40 50] b = [55 20 30 40 50] Is f linear? 11 Slide credit: Devi Parikh

Recall: Image filtering Compute a function of the local neighborhood at each pixel in the image Function specified by a filter or mask saying how to combine values from neighbors Uses of filtering: Enhance an image (denoise, resize, increase contrast, etc) Extract information (texture, edges, interest points, etc) Detect patterns (template matching), Adapted from Derek Hoiem 12

Edge detection Goal: map image from 2d array of pixels to a set of curves or line segments or contours. Why? Figure from J. Shotton et al., PAMI 2007 Main idea: look for strong gradients, post-process 13

What causes an edge? Reflectance change: appearance information, texture Depth discontinuity: object boundary Cast shadows Change in surface orientation: shape 14

Edges/gradients and invariance 15

Derivatives and edges An edge is a place of rapid change in the image intensity function. image intensity function (along horizontal scanline) first derivative Slide credit: Svetlana Lazebnik edges correspond to extrema of derivative 16

Derivatives with 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 + 17

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? 18 (showing filters for correlation)

Assorted finite difference filters >> My = fspecial( sobel ); >> outim = imfilter(double(im), My); >> imagesc(outim); >> colormap gray; 19

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 20

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? 21 Slide credit: Steve 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 Where is the edge? Look for peaks in 23

Derivative theorem of convolution Differentiation property of convolution. 24 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 ] 25

Derivative of Gaussian filters x-direction y-direction 26 Slide credit: Svetlana Lazebnik

Laplacian of Gaussian Consider Laplacian of Gaussian operator Where is the edge? Slide credit: Steve Seitz Zero-crossings of bottom graph 27

2D edge detection filters Laplacian of Gaussian Gaussian derivative of Gaussian is the Laplacian operator: 28 Slide credit: Steve Seitz

Smoothing with a Gaussian Recall: parameter σ is the scale / width / spread of the Gaussian kernel, and controls the amount of smoothing. 29

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 30 Slide credit: Yong Jae Lee, adapted from Kristen Grauman

So, what scale to choose? It depends what we re looking for. 31

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 32

Seam carving: main idea [Shai & Avidan, SIGGRAPH 2007] 33

Seam carving: main idea Content-aware resizing Traditional resizing [Shai & Avidan, SIGGRAPH 2007] 34

Seam carving: main idea video 35

Seam carving: main idea Content-aware resizing Intuition: Preserve the most interesting content Prefer to remove pixels with low gradient energy To reduce or increase size in one dimension, remove irregularly shaped seams Optimal solution via dynamic programming. 36

Seam carving: main idea Energy( f ) = Want to remove seams where they won t be very noticeable: Measure energy as gradient magnitude Choose seam based on minimum total energy path across image, subject to 8-connectedness. 37

Seam carving: algorithm s 1 s 2 s 3 s 4 s 5 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: Compute it efficiently with dynamic programming. h i= 1 Energy( f ( s i s* = min Cost( s) s )) 38

How to identify the minimum cost seam? How many possible seams are there? height h, width w First, consider a greedy approach: 1 2 5 3 8 2 0 9 6 Energy matrix (gradient magnitude) Slide credit: Adapted from Kristen Grauman 39

Seam carving: algorithm Compute the cumulative minimum energy for 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: cumulative min energy (for vertical seams) Then, min value in last row of M indicates end of the minimal connected vertical seam. Backtrack up from there, selecting min of 3 above in M. 40

Example ( M( i 1, j 1), M( i 1, j), M( i 1, 1) ) M( i, j) = Energy( i, j) + min j + 1 3 0 1 3 0 2 8 9 3 8 9 5 2 6 8 5 14 Energy matrix (gradient magnitude) M matrix (for vertical seams) 41

Example ( M( i 1, j 1), M( i 1, j), M( i 1, 1) ) M( i, j) = Energy( i, j) + min j + 1 3 0 1 3 0 2 8 9 3 8 9 5 2 6 8 5 14 Energy matrix (gradient magnitude) M matrix (for vertical seams) 42

Real image example Original Image Energy Map Blue = low energy Red = high energy 43

Real image example 44

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, averaged with neighbors Other energy functions may be plugged in E.g., color-based, interactive, Can use combination of vertical and horizontal seams 45

Example results from students at UT Austin Results from Eunho Yang 46

Results from Suyog Jain 47

Conventional resize Original image Seam carving result Results from Martin Becker 48

Conventional resize Original image Seam carving result Results from Martin Becker 49

Conventional resize (399 by 599) Original image (599 by 799) Seam carving (399 by 599) Results from Jay Hennig 50

Removal of a marked object Results from Donghyuk Shin 51

Removal of a marked object Results from Eunho Yang 52

Failure cases with seam carving By Donghyuk Shin 53

Failure cases with seam carving By Suyog Jain 54

Questions? See you Thursday!