by Shahid Farid 1
To process an image so that the result is more suitable than the original image for a specific application. Categories: Spatial domain methods and Frequency domain methods 2
Procedures that operate directly on the aggregate of pixels composing an image g ( x, y) = T[ f ( x, y)] A neighborhood about (xx, yy) is defined by using a square (or rectangular) subimage area centered at (xx, yy). 3
Image Enhancement in Spatial Domain 4
When the neighborhood is 1 1 then g depends only on the value of f at (xx, yy) and T becomes a gray-level transformation (or mapping) function: s=t(r) rr, ss: gray levels of ff(xx, yy) and gg(xx, yy) at (xx, yy) Examples: Point processing techniques (e.g. contrast stretching, thresholding) 5
Contrast Stretching Thresholding 6
Mask processing or filtering: when the values of ff in a predefined neighborhood of (xx, yy) determine the value of g at (xx, yy). through the use of masks (or kernels, templates, or windows, or filters). 7
These are methods based only on the intensity of single pixels. rr denotes the pixel intensity before processing. ss denotes the pixel intensity after processing. 8
1. Image negatives 2. Piecewise-Linear Transformation Functions: i. Contrast stretching ii. Gray-level slicing iii. Bit-plane slicing 9
Simple Intensity Transformations Linear: Negative, Identity Logarithmic: Log, Inverse Log Power-Law: nth power, nth root 10
[0,L-1] the range of gray levels SS = LL 1 rr 11
Function reverses the order from black to white so that the intensity of the output image decreases as the intensity of the input increases. Used mainly in medical images and to produce slides of the screen. 12
13
ss = cc log(1 + rr) where c: constant Compresses the dynamic range of images with large variations in pixel values 14
15
Gamma correction s = cr γ C, γ : positive constants 16
γ=c=1: identity 17
18
19
20
21
22
To increase the dynamic range of the gray levels in the image being processed. 23
The locations of (rr 1, ss 1 ) and (rr 2, ss 2 ) control the shape of the transformation function. If rr 1 = ss 1 and rr 2 = ss 2 the transformation is a linear function and produces no changes. If rr 1 = rr 2, ss 1 = 0 and ss 2 = LL 1, the transformation becomes a thresholding function that creates a binary image. Intermediate values of (rr 1, ss 1 ) and (rr 2, ss 2 ) produce various degrees of spread in the gray levels of the output image, thus affecting its contrast. Generally, rr 1 rr 2 and ss 1 ss 2 is assumed. 24
Contrast Stretching 25
To highlight a specific range of gray levels in an image (e.g. to enhance certain features). One way is to display a high value for all gray levels in the range of interest and a low value for all other gray levels (binary image). 26
The second approach is to brighten the desired range of gray levels but preserve the background and gray-level tonalities in the image. 27
28
29
To highlight the contribution made to the total image appearance by specific bits Assuming that each pixel is represented by 8 bits, the image is composed of 8 1-bit planes. Plane 0 contains the least significant bit and plane 7 contains the most significant bit. Only the higher order bits (top four) contain visually significant data. The other bit planes contribute the more subtle details. Plane 7 corresponds exactly with an image thresholded at gray level 128. 30
31
32
Original Image
Logic operations: pixel-wise AND, OR, NOT The pixel gray level values are taken as string of binary numbers Use the binary mask to take out the region of interest(roi) from an image 35
A B A and B AND A or B OR 36
f:original(8 bits) h:4 sig. bits Difference image gg(xx, yy) = ff(xx, yy) h(xx, yy) scaling difference image 37
gg(xx, yy) = ff(xx, yy) h(xx, yy) ff and h are 8-bit => gg(xx, yy) [ 255, 255] 1. (i)+255 (ii) divide by 2 The result won t cover [0,255] 2. (i)-min(g) (ii) *255/max(g) 38
Inject contrast medium into bloodstream original (head) difference image 39
Noisy image gg(xx, yy) = ff(xx, yy) + ηη(xx, yy) original noise Clear image Noisy image Suppose ηη(xx, yy) is uncorrelated and has zero mean 40
{ } ), ( ), ( y x f y x g E = 2 ), ( 2 ), ( 1 y x y x g K η σ σ = 2 σ K Averaging over K noisy images g i (x,y) = = K i i y x g K y x g 1 ), ( 1 ), ( 41
original Gaussian noise averaging K=8 averaging K=16 averaging K=64 averaging K=128 42
Few slides are borrowed from different sources 43
Lecture 4 By: Dr. Shahid Farid Assistant Professor, PUCIT Email: shahid@pucit.edu.pk 44