Computer Graphics and Image Processing Lecture B2 Point Processing Joseph Niepce, 1826. The view from my window 1
Context How much input is used to compute an output value? Point Transforms Region Transforms Image Transforms 2
Contents Brightness Transforms Image histogram Thresholding Zooming Geometric Transforms Grey Value Transforms Manipulating individual pixel values Brightness adjustment Contrast adjustment 3
Brightness Adjustment Add a constant to all values (k = 50) g = g + k Contrast Adjustment Scale all values by a constant (k = 1.5) g = g*k 4
Input-Output Mapping high + k high low + k low Input-Output Mapping high high * k low low * k 5
Input-Output Map This creates a lookup table relating input grey values to output out out Linear in in Non-linear Input-Output Mapping brightness Out contrast linear In 6
Image Histogram Measure frequency of occurrence of each grey/colour value Grey Value Histogram 12000 10000 Frequency 8000 6000 4000 2000 0 1 16 31 46 61 76 91 106 121 136 151 166 181 196 211 226 241 256 Grey Value Saturation 7
Scale by 1.25 Non-Linear Mappings Detail is less obvious at the extremes of the ranges By changing the inout mapping from linear to an S shape the detail is restored 8
out in Thresholding Transform grey/colour image to binary if f(x, y) > T output = 1 else 0 How to find T? out in 9
Threshold Value Aim to reduce misclassification error Assuming the two output values correspond to something sensible in the image Manual User defines a threshold P-Tile Mode Other automatic methods Misclassification N Class A Class B Grey 10
P-Tile If we know the proportion of the image that is object Threshold the image to select this proportion of pixels Mode Threshold at the minimum between the histogram s peaks. (Why mode?) 11
Automated Methods Find a threshold θ such that Average µ l Average µ h µ µ + l h θ = T = θ 2 (Start at θ = 0 and work upwards.) Optimal classifier Estimate mean and variance of populations Select T to minimise misclassification, p(c 1 ) = p(c 2 ) T C dx = p C dx T ( ) ( ) p 1 2 12
Image Zooming 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 Geometric Transformations Definitions Affine and non-affine transforms Applications Manipulating image shapes 13
Affine Transforms Scale, Shear, Rotate, Translate Length and areas preserved, Maybe not angles. x a = y d 1 g b e h c x f y i 1 Change values of transform matrix elements according to desired effect. a, e scaling b, d shearing a, b, d, e rotation c, f translation Affine Transform Examples 14
How do you (find and) level the horizon? Warping Example Ansell Adams Aspens 2 2 x ', y' = 1.2 x y + 1. 2x y + x Used to correct camera distortion. 15
16 Camera Lens distortion ( )( ) ( )( ) K K + + + + = + + + + = 6 6 4 4 2 2 6 6 4 4 2 2 1 1 r b r b r b y y y y r a r a r a x x x x c c c c
17
Image Resampling Moving source to destination pixels x and y could be non-integer Rounding x and y to nearest integer can create holes in image Solution is to manipulate in reverse where did warped pixel come from? source is non-integer interpolate nearest neighbours forward reverse Original Warped 18
Summary Chapter 3 (sections 3.1, 3.2, 3.5) Chapter 4 (section 4.1) Point manipulation Brightness Position There is no reason why anyone would want a computer in their home Ken Olsen, chairman DEC, 1977 19