660 likes | 672 Views
Image Transforms. Transforming images to images. Classification of Image Transforms. Point transforms modify individual pixels modify pixels’ locations Local transforms output derived from neighbourhood Global transforms whole image contributes to each output value. Point Transforms.
E N D
Image Transforms Transforming images to images
Classification of Image Transforms • Point transforms • modify individual pixels • modify pixels’ locations • Local transforms • output derived from neighbourhood • Global transforms • whole image contributes to each output value Image Processing and Computer Vision: 2
Point Transforms • Manipulating individual pixel values • Brightness adjustment • Contrast adjustment • Histogram manipulation • equalisation • Image magnification Image Processing and Computer Vision: 2
Grey Scale Manipulation • Brightness modifications • Contrast modifications • Histogram manipulation Image Processing and Computer Vision: 2
Brightness Adjustment Add a constant to all values g’ = g + k (k = 50) Image Processing and Computer Vision: 2
Contrast Adjustment Scale all values by a constant g’ = g*k (k = 1.5) Image Processing and Computer Vision: 2
Image Histogram • Measure frequency of occurrence of each grey/colour value Image Processing and Computer Vision: 2
Histogram Manipulation • Modify distribution of grey values to achieve some effect Image Processing and Computer Vision: 2
Equalisation/Adaptive Equalisation • Specifically to make histogram uniform Image Processing and Computer Vision: 2
Equalisation Transform • Equalised image has n x m/l pixels per grey level • Cumulative to level j • jnm/l pixels • Equate to a value in input cumulative histogram C[i] • C[i] = jnm/l • j = C[i]l/nm • Modifications to prevent mapping to –1. Image Processing and Computer Vision: 2
Thresholding • Transform grey/colour image to binary if f(x, y) > T output = 1 else 0 • How to find T? Image Processing and Computer Vision: 2
Threshold Value • Manual • User defines a threshold • P-Tile • Mode • Other automatic methods Image Processing and Computer Vision: 2
P-Tile • If we know the proportion of the image that is object • Threshold the image to select this proportion of pixels Image Processing and Computer Vision: 2
Mode Threshold at the minimum between the histogram’s peaks. Image Processing and Computer Vision: 2
Average l Average h Automated Methods Find a threshold such that (Start at = 0 and work upwards.) Image Processing and Computer Vision: 2
Image Magnification • Reducing • new value is weighted sum of nearest neighbours • new value equals nearest neighbour • Enlarging • new value is weighted sum of nearest neighbours • add noise to obscure pixelation Image Processing and Computer Vision: 2
Local Transforms • Convolution • Applications • smoothing • sharpening • matching Image Processing and Computer Vision: 2
Convolution Definition Place template on image Multiply overlapping values in image and template Sum products and normalise (Templates usually small) Image Processing and Computer Vision: 2
Example Image Template Result … . . . . . ... … 3 5 7 4 4 … … 4 5 8 5 4 … … 4 6 9 6 4 … … 4 6 9 5 3 … … 4 5 8 5 4 … … . . . . . ... … . . . . . ... … . . . . . ... … . 6 6 6 . … … . 6 7 6 . … … . 6 7 6 . … … . . . . . ... … . . . . . ... 1 1 1 1 2 1 1 1 1 Divide by template sum Image Processing and Computer Vision: 2
Separable Templates • Convolve with n x n template • n2 multiplications and additions • Convolve with two n x 1 templates • 2n multiplications and additions Image Processing and Computer Vision: 2
Example 0 –1 0 -1 4 –1 0 –1 0 • Laplacian template • Separated kernels -1 2 -1 -1 2 -1 Image Processing and Computer Vision: 2
Composite Filters • Convolution is distributive • Can create a composite filter and do a single convolution • Not convolve image with one filter and convolve result with second. • Efficiency gain Image Processing and Computer Vision: 2
Applications • Usefulness of convolution is the effects generated by changing templates • Smoothing • Noise reduction • Sharpening • Edge enhancement • Template matching • A later lecture Image Processing and Computer Vision: 2
Smoothing • Aim is to reduce noise • What is “noise”? • How is it reduced • Addition • Adaptively • Weighted Image Processing and Computer Vision: 2
Noise Definition • Noise is deviation of a value from its expected value • Random changes • x x + n • Salt and pepper • x {max, min} Image Processing and Computer Vision: 2
Noise Reduction • By smoothing S(x + n) = S(x) + S(n) = S(x) • Since noise is random and zero mean • Smooth locally or temporally • Local smoothing • Removes detail • Introduces ringing Image Processing and Computer Vision: 2
Adaptive Smoothing • Compute smoothed value, s Output = s if |s – x| > T x otherwise Image Processing and Computer Vision: 2
Median Smoothing Median is one value in an ordered set: 1 2 3 4 5 6 7 median = 4 2 3 4 5 6 7 median = 4.5 Image Processing and Computer Vision: 2
Original Smoothed Median Smoothing Image Processing and Computer Vision: 2
Gaussian Smoothing • To reduce ringing • Weighted smoothing • Numbers from Gaussian (normal) distribution are weights. Image Processing and Computer Vision: 2
Sharpening • What is it? • Enhancing discontinuities • Edge detection • Why do it? • Perceptually important • Computationally important Image Processing and Computer Vision: 2
Edge Definition Image Processing and Computer Vision: 2
Edge Types • Step edge • Line edge • Roof edge • Real edges Image Processing and Computer Vision: 2
First Derivative, Gradient Edge Detection • If an edge is a discontinuity • Can detect it by differencing Image Processing and Computer Vision: 2
Roberts Cross Edge Detector • Simplest edge detector • Inaccurate localisation Image Processing and Computer Vision: 2
Prewitt/Sobel Edge Detector Image Processing and Computer Vision: 2
Edge Detection • Combine horizontal and vertical edge estimates Image Processing and Computer Vision: 2
Problems • Enhanced edges are noise sensitive • Scale • What is “local”? Image Processing and Computer Vision: 2
Canny/Deriche Edge Detector • Require • edges to be detected • accurate localisation • single response to an edge • Solution • Convolve image with Difference of Gaussian (DoG) Image Processing and Computer Vision: 2
Example Results Image Processing and Computer Vision: 2
Second Derivative Operators Zero Crossing • Model HVS • Locate edge to subpixel accuracy • Convolve image with Laplacian of Gaussian (LoG) • Edge location at crossing of zero axis Image Processing and Computer Vision: 2
Example Results Image Processing and Computer Vision: 2
Global Transforms • Computing a new value for a pixel using the whole image as input • Cosine and Sine transforms • Fourier transform • Frequency domain processing • Hough transform • Karhunen-Loeve transform • Wavelet transform Image Processing and Computer Vision: 2
Cosine/Sine • A halfway solution to the Fourier Transform • Used in image coding Image Processing and Computer Vision: 2
Fourier • All periodic signals can be represented by a sum of appropriately weighted sine/cosine waves Image Processing and Computer Vision: 2
Transformed section of BT Building image. Image Processing and Computer Vision: 2
Frequency Domain Filtering • Convolution Theorem: Convolution in spatial domain is equivalent to Multiplication in frequency domain Image Processing and Computer Vision: 2
Smoothing Suppress high frequency components Image Processing and Computer Vision: 2
Sharpening Suppress low frequency components Image Processing and Computer Vision: 2