Lecture 2: Edge detection and resampling

Slides:



Advertisements
Similar presentations
Lecture 2: Convolution and edge detection CS4670: Computer Vision Noah Snavely From Sandlot ScienceSandlot Science.
Advertisements

Image Interpolation CS4670: Computer Vision Noah Snavely.
Edge detection Goal: Identify sudden changes (discontinuities) in an image Intuitively, most semantic and shape information from the image can be encoded.
Edge detection. Edge Detection in Images Finding the contour of objects in a scene.
Image Filtering, Part 2: Resampling Today’s readings Forsyth & Ponce, chapters Forsyth & Ponce –
Convolution, Edge Detection, Sampling : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz.
Sampling and Pyramids : Rendering and Image Processing Alexei Efros …with lots of slides from Steve Seitz.
Announcements Mailing list: –you should have received messages Project 1 out today (due in two weeks)
Edges and Scale Today’s reading Cipolla & Gee on edge detection (available online)Cipolla & Gee on edge detection Szeliski – From Sandlot ScienceSandlot.
Image Sampling Moire patterns
Edge Detection Today’s reading Forsyth, chapters 8, 15.1
Lecture 3: Edge detection, continued
Lecture 4: Image Resampling CS4670: Computer Vision Noah Snavely.
Lecture 3: Image Resampling CS4670: Computer Vision Noah Snavely Nearest-neighbor interpolation Input image 3x upsample hq3x interpolation (ZSNES)
Lecture 2: Image filtering
Edge Detection Today’s readings Cipolla and Gee –supplemental: Forsyth, chapter 9Forsyth Watt, From Sandlot ScienceSandlot Science.
Image Sampling Moire patterns -
Edge detection Goal: Identify sudden changes (discontinuities) in an image Intuitively, most semantic and shape information from the image can be encoded.
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5409 T-R 10:30am – 11:50am.
Computer Vision Spring ,-685 Instructor: S. Narasimhan WH 5409 T-R 10:30 – 11:50am.
CS559: Computer Graphics Lecture 3: Digital Image Representation Li Zhang Spring 2008.
Image Resampling CS4670: Computer Vision Noah Snavely.
Lecture 2: Edge detection CS4670: Computer Vision Noah Snavely From Sandlot ScienceSandlot Science.
Image Resampling CS4670: Computer Vision Noah Snavely.
Image Processing Edge detection Filtering: Noise suppresion.
Lecture 3: Edge detection CS4670/5670: Computer Vision Kavita Bala From Sandlot ScienceSandlot Science.
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
Computer Vision Spring ,-685 Instructor: S. Narasimhan Wean 5403 T-R 3:00pm – 4:20pm.
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.
Many slides from Steve Seitz and Larry Zitnick
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.
Lecture 5: Image Interpolation and Features
Brent M. Dingle, Ph.D Game Design and Development Program Mathematics, Statistics and Computer Science University of Wisconsin - Stout Image Processing.
Lecture 5: Fourier and Pyramids
Announcements Project 0 due tomorrow night. Edge Detection Today’s readings Cipolla and Gee (handout) –supplemental: Forsyth, chapter 9Forsyth For Friday.
COMPUTER VISION D10K-7C02 CV05: Edge Detection Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
Lecture 8: Edges and Feature Detection
Projects Project 1a due this Friday Project 1b will go out on Friday to be done in pairs start looking for a partner now.
Last Lecture photomatix.com. Today Image Processing: from basic concepts to latest techniques Filtering Edge detection Re-sampling and aliasing Image.
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
Miguel Tavares Coimbra
Image Resampling & Interpolation
Edge Detection slides taken and adapted from public websites:
Image Sampling Moire patterns
Edge Detection CS 678 Spring 2018.
Lecture 2: Edge detection
Image Sampling Moire patterns
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 Today’s reading
Samuel Cheng Slide credits: Noah Snavely
Edge Detection Today’s reading
Image Processing Today’s readings For Monday
Lecture 2: Edge detection
Filtering Part 2: Image Sampling
Image Sampling Moire patterns
Edge Detection Today’s reading
Image Resampling & Interpolation
Resampling.
Edge Detection Today’s readings Cipolla and Gee Watt,
Lecture 2: Edge detection
Samuel Cheng Slide credits: Noah Snavely
Winter in Kraków photographed by Marcin Ryczek
IT472 Digital Image Processing
IT472 Digital Image Processing
Presentation transcript:

Lecture 2: Edge detection and resampling CS6670: Computer Vision Noah Snavely Lecture 2: Edge detection and resampling From Sandlot Science

Administrivia New room starting Thursday: HLS B11

Administrivia Assignment 1 (feature detection and matching) will be out Thursday Turning via CMS: https://cms.csuglab.cornell.edu/ Mailing list: please let me know if you aren’t on it

Reading Szeliski: 3.4.1, 3.4.2

Last time: Cross-correlation Let be the image, be the kernel (of size 2k+1 x 2k+1), and be the output image This is called a cross-correlation operation:

Last time: Convolution Same as cross-correlation, except that the kernel is “flipped” (horizontally and vertically) This is called a convolution operation:

Linear filters: examples * 1 = Original Identical image Source: D. Lowe

Linear filters: examples * 1 = Original Shifted left By 1 pixel Source: D. Lowe

Linear filters: examples 1 * = Original Blur (with a mean filter) Source: D. Lowe

Linear filters: examples Sharpening filter (accentuates edges) 1 2 - * = Original Source: D. Lowe

(each pixel has some chance of being switched to zero or one) Image noise Original image Gaussian noise Salt and pepper noise (each pixel has some chance of being switched to zero or one) http://theory.uchicago.edu/~ejm/pix/20d/tests/noise/index.html

Gaussian noise = 1 pixel = 2 pixels = 5 pixels Smoothing with larger standard deviations suppresses noise, but also blurs the image

Salt & pepper noise – Gaussian blur = 1 pixel = 2 pixels = 5 pixels p = 10% What’s wrong with the results?

Alternative idea: Median filtering A median filter operates over a window by selecting the median intensity in the window Better at salt’n’pepper noise Not convolution: try a region with 1’s and a 2, and then 1’s and a 3 Is median filtering linear? Source: K. Grauman

Median filter What advantage does median filtering have over Gaussian filtering? Source: K. Grauman

Salt & pepper noise – median filtering = 1 pixel = 2 pixels = 5 pixels 3x3 window 5x5 window 7x7 window

Questions?

Edge detection Convert a 2D image into a set of curves Extracts salient features of the scene More compact than pixels TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAA

Origin of Edges Edges are caused by a variety of factors surface normal discontinuity depth discontinuity surface color discontinuity illumination discontinuity Edges are caused by a variety of factors

Characterizing edges An edge is a place of rapid change in the image intensity function intensity function (along horizontal scanline) image first derivative edges correspond to extrema of derivative Source: L. Lazebnik

Image derivatives How can we differentiate a digital image F[x,y]? Option 1: reconstruct a continuous image, f, then compute the derivative Option 2: take discrete derivative (finite difference) How would you implement this as a linear filter? 1 -1 -1 1 : : Source: S. Seitz

Image gradient The gradient of an image: The gradient points in the direction of most rapid increase in intensity The edge strength is given by the gradient magnitude: The gradient direction is given by: how does this relate to the direction of the edge? give definition of partial derivative: lim h->0 [f(x+h,y) – f(x,y)]/h Source: Steve Seitz

Image gradient Source: L. Lazebnik

Effects of noise Where is the edge? Noisy input image Source: S. Seitz How to fix? Where is the edge? Source: S. Seitz

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

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

2D edge detection filters derivative of Gaussian (x) Gaussian How many 2nd derivative filters are there? There are four 2nd partial derivative filters. In practice, it’s handy to define a single 2nd derivative filter—the Laplacian

Derivative of Gaussian filter x-direction y-direction

The Sobel operator Common approximation of derivative of Gaussian -1 1 -2 2 1 2 -1 -2 Q: Why might these work better? A: more stable when there is noise The standard defn. 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 29

Sobel operator: example Source: Wikipedia

Example original image (Lena)

Finding edges gradient magnitude

Finding edges where is the edge? thresholding

Non-maximum supression Check if pixel is local maximum along gradient direction requires interpolating pixels p and r

Finding edges thresholding

(non-maximum suppression) Finding edges thinning (non-maximum suppression)

Source: D. Lowe, L. Fei-Fei Canny edge detector MATLAB: edge(image,‘canny’) Filter image with derivative of Gaussian Find magnitude and orientation of gradient Non-maximum suppression 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 Source: D. Lowe, L. Fei-Fei

Canny edge detector Still one of the most widely used edge detectors in computer vision Depends on several parameters: J. Canny, A Computational Approach To Edge Detection, IEEE Trans. Pattern Analysis and Machine Intelligence, 8:679-714, 1986. : width of the Gaussian blur high threshold low threshold

Canny edge detector original Canny with Canny with The choice of depends on desired behavior large detects “large-scale” edges small detects fine edges Source: S. Seitz

Scale space (Witkin 83) larger 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

Questions?

Image Scaling This image is too big to fit on the screen. How can we generate a half-sized version? Source: S. Seitz

Image sub-sampling 1/8 1/4 Throw away every other row and column to create a 1/2 size image - called image sub-sampling Source: S. Seitz

Image sub-sampling 1/2 1/4 (2x zoom) 1/8 (4x zoom) Why does this look so crufty? Source: S. Seitz

Image sub-sampling Source: F. Durand

Even worse for synthetic images Source: L. Zhang

Aliasing Occurs when your sampling rate is not high enough to capture the amount of detail in your image Can give you the wrong signal/image—an alias To do sampling right, need to understand the structure of your signal/image Enter Monsieur Fourier… To avoid aliasing: sampling rate ≥ 2 * max frequency in the image said another way: ≥ two samples per cycle This minimum sampling rate is called the Nyquist rate Source: L. Zhang

Wagon-wheel effect (See http://www.michaelbach.de/ot/mot_wagonWheel/index.html) Source: L. Zhang

Gaussian pre-filtering Solution: filter the image, then subsample Source: S. Seitz

Subsampling with Gaussian pre-filtering Solution: filter the image, then subsample Source: S. Seitz

Compare with... 1/2 1/4 (2x zoom) 1/8 (4x zoom) Source: S. Seitz

Gaussian pre-filtering Solution: filter the image, then subsample F1 F2 … blur subsample blur subsample F0 H * F1 H *

{ … F0 F0 H * Gaussian pyramid F1 F1 H * F2 blur subsample blur

Gaussian pyramids [Burt and Adelson, 1983] In computer graphics, a mip map [Williams, 1983] A precursor to wavelet transform Gaussian Pyramids have all sorts of applications in computer vision Source: S. Seitz

Gaussian pyramids [Burt and Adelson, 1983] How much space does a Gaussian pyramid take compared to the original image? Source: S. Seitz

Questions?

Upsampling This image is too small for this screen: How can we make it 10 times as big? Simplest approach: repeat each row and column 10 times (“Nearest neighbor interpolation”)

Image interpolation Recall how a digital image is formed d = 1 in this example 1 2 3 4 5 Recall how a digital image is formed It is a discrete point-sampling of a continuous function If we could somehow reconstruct the original function, any new image could be generated, at any resolution and scale Adapted from: S. Seitz

Image interpolation Recall how a digital image is formed d = 1 in this example 1 2 3 4 5 Recall how a digital image is formed It is a discrete point-sampling of a continuous function If we could somehow reconstruct the original function, any new image could be generated, at any resolution and scale Adapted from: S. Seitz

Image interpolation What if we don’t know ? Guess an approximation: 1 d = 1 in this example 1 2 2.5 3 4 5 What if we don’t know ? Guess an approximation: Can be done in a principled way: filtering Convert to a continuous function: Reconstruct by convolution with a reconstruction filter, h Adapted from: S. Seitz

Image interpolation “Ideal” reconstruction Nearest-neighbor interpolation Linear interpolation Gaussian reconstruction Source: B. Curless

Reconstruction filters What does the 2D version of this hat function look like? performs linear interpolation (tent function) performs bilinear interpolation Often implemented without cross-correlation E.g., http://en.wikipedia.org/wiki/Bilinear_interpolation Better filters give better resampled images Bicubic is common choice Cubic reconstruction filter

Image interpolation Original image: x 10 Nearest-neighbor interpolation Bilinear interpolation Bicubic interpolation

Image interpolation Also used for resampling

Questions?

Next time: image features