Computer Vision Lecture 3 - Intensity transformation Instructor: Ha Dai Duong duonghd@mta.edu.vn 22/09/2015 1 Today s class 1. Gray level transformations 2. Bit-plane slicing 3. Arithmetic/logic operators 4. Discussion 22/09/2015 2 1
Today s class 1. Gray level transformations 2. Bit-plane slicing 3. Arithmetic/logic operators 4. Discussion 22/09/2015 3 Spatial domain The term spatial domain refers to the aggregate of pixels composing an image. Spatial domain methods are procedures that operate directly on these pixels. Spatial domain processes will be denoted by the expression where f(x,y) is the input image, g(x,y) is the processed image, and T is an operator on f, defined over some neighborhood of (x,y) 22/09/2015 4 2
Spatial domain The principal approach in defining a neighborhood about a (x,y) is to use a square subimage area centered at (x, y), as Fig. 3.1 22/09/2015 5 Spatial domain The operator T is applied at each location (x,y) to yield the output, g, at that location. The simplest form of T is when the neighborhood is of size 1*1 (that is, a single pixel). In this case, g depends only on the value of f at (x, y), and T becomes a gray-level transformation function 22/09/2015 6 3
Spatial domain Example 22/09/2015 7 Some basic gray-level transformations 22/09/2015 8 4
Image negative Definition: or 22/09/2015 9 Image negative Definition: Example or 22/09/2015 10 5
Example of performing 1 2 3 4 0 1 2 3 4 0 1 2 f Negative g 3 4 0 1 L-1 = 4 22/09/2015 11 Example of performing 1 2 3 4 0 1 2 3 4 0 1 2 f Negative g 3 3 4 0 1 L-1 = 4 22/09/2015 12 6
Example of performing 1 2 3 4 0 1 2 3 4 0 1 2 f Negative g 3 2 3 4 0 1 L-1 = 4 22/09/2015 13 Example of performing 1 2 3 4 0 1 2 3 4 0 1 2 f Negative g 3 2 1 3 4 0 1 L-1 = 4 22/09/2015 14 7
Example of performing 1 2 3 4 0 1 2 3 4 0 1 2 f Negative g 3 2 1 0 3 4 0 1 L-1 = 4 22/09/2015 15 Example of performing 1 2 3 4 0 1 2 3 4 0 1 2 f Negative g 3 2 1 0 4 3 4 0 1 L-1 = 4 22/09/2015 16 8
Example of performing 1 2 3 4 0 1 2 3 4 0 1 2 f Negative g 3 2 1 0 4 3 3 4 0 1 L-1 = 4 22/09/2015 17 Example of performing 1 2 3 4 0 1 2 3 4 0 1 2 f Negative g 3 2 1 0 4 3 2 1 0 4 3 2 3 4 0 1 1 0 4 3 L-1 = 4 22/09/2015 18 9
Discussion C/C++ and OpenCV implementation More on project 22/09/2015 19 Look Up Table The size of image is M N => Function T(r) is called M N times. Create and compute LUT[r] = T(r), r=0.. L-1 => Function T(r) is called L ( L<< M N ) times s = LUT[r] LUT - Look Up Table 22/09/2015 20 10
Example 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 LUT 0 4 1 3 2 2 3 1 4 0 f g L-1 = 4 22/09/2015 21 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 Example LUT 0 4 1 3 2 2 3 1 4 0 f g L-1 = 4 22/09/2015 22 3 11
Example 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 LUT 0 4 1 3 2 2 3 1 4 0 3 2 f g L-1 = 4 22/09/2015 23 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 Example LUT 0 4 1 3 2 2 3 1 4 0 3 2 1 f g L-1 = 4 22/09/2015 24 12
Log Transformations Definition: or where c is a constant, and it is assumed that r>=0 22/09/2015 25 Definition: Example or where c is a constant, and it is assumed that r>=0 22/09/2015 26 13
Power-Law Transformations Definition: or 22/09/2015 27 Power-Law Transformations Definition: or 22/09/2015 28 14
Example Definition: or 22/09/2015 29 Definition: Example or 22/09/2015 30 15
Contrast stretching Definition: 22/09/2015 31 Example 22/09/2015 32 16
Gray-level slicing Definition 22/09/2015 33 Example 22/09/2015 34 17
Gray-level slicing Definition 22/09/2015 35 Today s class 1. Gray level transformations 2. Bit-plane slicing 3. Arithmetic/logic operators 4. Discussion 22/09/2015 36 18
Bit-plane Often by isolating particular bits of the pixel values in an image We can highlight interesting aspects of that image 22/09/2015 37 Example [10000000] [01000000] [00100000] [00001000] [00000100] [00000001] 22/09/2015 38 19
Example 22/09/2015 39 Higher-order bits usually contain most of the significant visual information Lower-order bits contain subtle details Lower-order bit-plane 22/09/2015 40 20
Higher-order bit-plane Higher-order bits usually contain most of the significant visual information Lower-order bits contain subtle details 22/09/2015 41 Bit-plane slicing Reconstructed image using only bit planes 8 and 7 Reconstructed image using only bit planes 8, 7 and 6 Reconstructed image using only bit planes 7, 6 and 5 22/09/2015 42 21
Today s class 1. Gray level transformations 2. Bit-plane slicing 3. Arithmetic/logic operators 4. Discussion 22/09/2015 43 Definition: Image Subtraction g(x,y) = f(x,y) h(x,y) Extraction of the differences between images 22/09/2015 44 22
Image Subtraction Example 22/09/2015 45 Image Averaging Consider a noisy image g(x,y) formed by the addition of noise (x,y) to an original image f(x,y) g(x,y) = f(x,y) + (x,y) If noise has zero mean and be uncorrelated then it can be shown that if K 1 g( x, y) gi ( x, y) K i 1 image formed by averaging K different noisy images 22/09/2015 46 23
Image Averaging Then 2 1 g ( x, y) K 2 ( x, y) 2 2 g ( x, y ), ( x, y ) = variances of g and if K increase, it indicates that the variability (noise) of the pixel at each location (x,y) decreases. 22/09/2015 47 Image Averaging Thus E{ g( x, y)} f ( x, y) E { g ( x, y)} = expected value of g (output after averaging) = original image f(x,y) 22/09/2015 48 24
(a) Image of Galaxy Pair NGC 3314 (b) Image corrupted by additive Gauss-ian noise with zero mean and a standard deviation of 64 gray levels 22/09/2015 49 (c) Results of averaging K=8 (d) Results of averaging K=16 22/09/2015 50 25
(e) Results of averaging K=64 (f) Results of averaging K=128 22/09/2015 51 (a) Image of Galaxy Pair NGC 3314 (f) Results of averaging K=128 22/09/2015 52 26
Logical operators 22/09/2015 53 Today s class 1. Gray level transformations 2. Bit-plane slicing 3. Arithmetic/logic operators 4. Discussion 22/09/2015 54 27