390 likes | 399 Views
Discover image processing as a function in Computer Vision Lecture #3, including point operations, convolution, Gaussian smoothing, and more. Learn about image processing techniques using Fourier Transform and convolution kernels.
E N D
Computer Vision Spring 2012 15-385,-685 Instructor: S. Narasimhan Wean Hall 5409 T-R 10:30am – 11:50am
Image Processing and Filtering Lecture #3
Image as a Function • We can think of an image as a function, f, • f:R2R • f (x, y)gives the intensity at position (x, y) • Realistically, we expect the image only to be defined over a rectangle, with a finite range: • f: [a,b]x[c,d] [0,1] • A color image is just three functions pasted together. We can write this as a “vector-valued” function:
Image Processing • Define a new image g in terms of an existing image f • We can transform either the domain or the range of f • Range transformation: What kinds of operations can this perform?
Point Processing Nonlinear Lower Contrast Original Darken Lower Contrast Nonlinear Raise Contrast Invert Lighten Raise Contrast
Point Processing x + 128 x - 128 255 - x x / 2 x * 2 x ((x / 255.0) ^ 0.33) * 255.0 ((x / 255.0) ^2) * 255.0 Nonlinear Lower Contrast Original Darken Lower Contrast Nonlinear Raise Contrast Invert Lighten Raise Contrast
Neighborhood operations Image Edge detection Blur
Image Processing • Some operations preserve the range but change the domain of f : What kinds of operations can this perform? • Still other operations operate on both the domain and the range of f .
Linear Shift Invariant Systems (LSIS) Linearity: Shift invariance:
LSIS Example of LSIS Defocused image ( g ) is a processed version of the focused image ( f ) Ideal lens is a LSIS Linearity: Brightness variation Shift invariance: Scene movement (not valid for lenses with non-linear distortions)
Convolution LSIS is doing convolution; convolution is linear and shift invariant kernel h
Convolution - Example Eric Weinstein’s Math World
Convolution - Example 1 1 -1 1 -1 1 1 -2 -1 1 2
Convolution Kernel – Impulse Response • What h will give us g = f ? Dirac Delta Function (Unit Impulse) Sifting property:
Optical System point source point spread function • However, optical systems are never ideal. • Point spread function of Human Eyes Point Spread Function Optical System scene image • Ideally, the optical system should be a Dirac delta function.
Point Spread Function normal vision myopia hyperopia astigmatism Images by Richmond Eye Associates
Cascade system Properties of Convolution • Commutative • Associative
Convolution Fourier Transform Inverse Fourier Transform Images are Discrete and Finite
For n=2, convolve pixel values with 2D images: 2 1 1 1 1 then (a) use or (b) use 1 1 1 2 2 2 1 1 1 2 2 2 2 4 1 1 1 2 1 Averaging Let’s think about averaging pixel values Which is faster?
Averaging large Repeated averaging Gaussian smoothing The convolution kernel
pixels Filter size …can be very large 2D Gaussian is separable! Gaussian Smoothing Gaussian kernel (truncate, if necessary) Use two 1D Gaussian filters
Gaussian Smoothing • A Gaussian kernel gives less weight to pixels further from the center of the window (5x5, sigma=0.5) 0.0000 0.0000 0.0002 0.0000 0.0000 0.0000 0.0113 0.0837 0.0113 0.0000 0.0002 0.0837 0.6187 0.0837 0.0002 0.0000 0.0113 0.0837 0.0113 0.0000 0.0000 0.0000 0.0002 0.0000 0.0000 • This kernel is an approximation of a Gaussian function:
Gaussian Smoothing original
Gaussian Smoothing by Charles Allen Gillbert by Harmon & Julesz http://www.michaelbach.de/ot/cog_blureffects/index.html
Gaussian Smoothing http://www.michaelbach.de/ot/cog_blureffects/index.html
Border Problem • Ignore • Output image will be smaller than original • Pad with constant values • Can introduce substantial 1st order derivative values • Pad with reflection • Can introduce substantial 2nd order derivative values
Median filtering sort median Median Filter (a) • Smoothing is averaging (a) Blurs edges (b) Sensitive to outliers (b) • Sort values around the pixel • Select middle value (median) • Non-linear (Cannot be implemented with convolution)
Gaussian noise Salt and pepper noise 3x3 5x5 7x7
Minimize • Maximize Correlation template How do we locate the template in the image? Cross-correlation
Problem: A C B t f We need to be the maximum! Cross-correlation Note: Auto-correlation
Normalized Correlation • Account for energy differences
Announcements • Project 1 will be out later this evening. • WARNING! Start projects early.
Next Class • Image Processing and Filtering (continued) • Fourier or frequency domain analysis • Horn, Chapter 6