Computer Vision Spring ,-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: R 2 R –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 as a 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 Operations
Point Processing Original Darken Invert Lighten Lower Contrast Raise Contrast Nonlinear Raise Contrast Nonlinear Lower Contrast
Point Processing Original Darken Invert Lighten Lower Contrast Raise Contrast Nonlinear Raise Contrast Nonlinear Lower Contrast x + 128x * x ((x / 255.0) ^2) * x - 128x / 2x ((x / 255.0) ^ 0.33) * 255.0
Neighborhood Operations
Neighborhood operations Image Edge detectionBlur
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. Image Processing
Face Morphing
Linear Shift Invariant Systems (LSIS) Linearity: Shift invariance:
Example of LSIS Defocused image ( g ) is a processed version of the focused image ( f ) Ideal lens is a LSIS 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
Convolution Kernel – Impulse Response What h will give us g = f ? Dirac Delta Function (Unit Impulse) Sifting property:
Point Spread Function Optical System sceneimage Ideally, the optical system should be a Dirac delta function. Optical System point sourcepoint spread function However, optical systems are never ideal. Point spread function of Human Eyes
Point Spread Function normal visionmyopiahyperopia Images by Richmond Eye Associates astigmatism
Properties of Convolution Commutative Associative Cascade system
Images are Discrete and Finite Convolution Fourier Transform Inverse Fourier Transform
Averaging Let’s think about averaging pixel values For n=2, convolve pixel values with 121 2D images: 121 (a) use then or (b) use Which is faster?
The convolution kernel large Repeated averaging Gaussian smoothing Averaging
Gaussian Smoothing Gaussian kernel pixels Filter size…can be very large (truncate, if necessary) 2D Gaussian is separable! Use two 1D Gaussian filters
A Gaussian kernel gives less weight to pixels further from the center of the window (5x5, sigma=0.5) This kernel is an approximation of a Gaussian function: Gaussian Smoothing
original
Mean vs. Gaussian filtering
Gaussian Smoothing by Charles Allen Gillbert by Harmon & Julesz
Gaussian Smoothing
Border Problem
Ignore –Output image will be smaller than original Pad with constant values –Can introduce substantial 1 st order derivative values Pad with reflection –Can introduce substantial 2 nd order derivative values
Median Filter Smoothing is averaging (a) Blurs edges (b) Sensitive to outliers (a) (b) –Sort values around the pixel –Select middle value (median) –Non-linear (Cannot be implemented with convolution) Median filtering sortmedian
3x3 5x5 7x7 Salt and pepper noise Gaussian noise
Correlation How do we locate the template in the image? Minimize Maximize Cross-correlation template
Cross-correlation Note: Auto-correlation We need to be the maximum! A B C f t Problem:
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