Image Enhancement (Spatial Domain Methods)
What Is Image Enhancement?
Image enhancement is the process of making images more useful The reasons for doing this include:
Highlighting interesting detail in images
Removing noise from images Making images more visually appealing
Image Enhancement
Enhance otherwise hidden information Filter important image features Discard unimportant image features Emphasize, sharpen or smoothen image features
Classification of Image enhancement
Spatial Domain Process intensity of pixels Two types- intensity transformation and spatial filtering
Transform Domain
Transform image, process it and then find inverse transform to get image in spatial domain
Basic of Spatial Domain Filtering
g (x, y) = T[ f (x, y)] f (x, y) is the input image g (x, y) is the processed image
(x, y) Origin y
and T is operator defined over some neighbourhood of (x, y)
x Image f (x, y)
Point Processing
Point processing operations take the form s=T(r)
s refers to the processed image pixel value and r
refers to the original image pixel value
T is referred to as a grey level transformation function
or a point processing operation f(x,y) g(x,y)
Spatial Domain
The operator T can be defined over
The set of pixels (x,y) of the image The set of neighborhoods, N(x,y) of
each pixel
Classification of spatial domain
Point operation
Mask operation
Global operation
Point operation
Brightness modification
Contrast manipulation
Histogram manipulation
Spatial Domain
Operation on the set of image-pixels
0 10
3 6
0 5
12 200 20
100 10
(Operator: Div. by 2)
Spatial Domain
Operation on the set of neighborhood
6 8 (Operator: sum)
12 200
6 8 2 0 10 226
12 200 20
Spatial Domain
Global Operation
6 8 2 0
12 200 20 10
(Operator: sum) 11 13 3 0 14
14 220 23 5 2 5 20 1 3 0 4
Transformations
Gray Level/Intensity Transformations
Brightness modification Image negatives Piecewise-Linear transformation
Functions Log transformations Power Law transformations
Intensity Level Transformations
Linear
Negative/Identity
Logarithmic
Log/Inverse log
Power
law
nth power/nth root
Image Negative
Suited for enhancing white or grey detail embedded in dark region and black area predominates
Output gray level
g(x,y)= 255- f(x,y)
Input gray level
Logarithmic Transformations
The log transformation maps a narrow range of low input grey level values into a wider range of output values
The inverse log transformation performs the opposite transformation
g(x,y) = c * log (1+ f(x,y))
Log Transformations
Input grey level values has large range of values
InvLog
Log
Log Transformations
Logarithm of FT reveals more details Range, 0 to 106 becomes 0 to 6.2
Power Law Transformations T(f) = c*f
Transformations
>1 Compresses dark values Expands bright values <1 Expands dark values Compresses bright values
Power Law Transformations
s=c*r Map a narrow range of dark input values into a wider range of output values or vice versa
Varying gives a whole family of curves
Application of gamma correction
A cathode ray tube (CRT) converts a video signal to light in a nonlinear way. The light intensity I is proportional to a power () of the source voltage V, (I=V) For a computer CRT, is about 2.2 To view image on monitors -correction is required
Application of gamma-correction
Power Law Example
Magnetic Resonance (MR) image of a fractured human spine
Power Law Example ( = 0.6)
= 0.6
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 Old Intensities
Transformed Intensities
Power Law Example ( = 0.4)
= 0.4
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 Original Intensities
Transformed Intensities
Power Law Example ( = 0.3)
= 0.3
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 Original Intensities
Transformed Intensities
Power Law Example (cont)
s = r 0.6
s = r 0.4
Power Law Example (Image with washed out appearance)
An aerial view of a runway
Image after gamma correction ( > 1)
= 5.0
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.2 0.4 0.6 0.8 1 Original Intensities
Transformed Intensities
s = r 3.0
Different curves highlight different detail
s = r 4.0
Brightness/contrast modification
g(m,n) = f(m,n) + k (increase brightness) g(m,n) = f(m,n) k (decrease brightness)
Piecewise Linear Transformations
Thresholding Function
g(x,y) = L-1, f(x,y) > t = 0, f(x,y) < t t = threshold level
Output gray level Input gray level
Thresholding
Thresholding transformations are particularly useful for segmentation in which we want to isolate an object of interest from a background
1.0 r > threshold s= 0.0 r <= threshold
Contrast stretching
Gray/Intensity Level Slicing
Highlight a specific range of gray values Two approaches:
Display high value for range of interest, low value else (discard background) Display high value for range of interest, original value else (preserve background)
Gray Level Slicing, example
Bit Plane Slicing
Isolate particular bits of intensity value
Shows contribution of each bit
Higher-order bits usually contain most of the significant visual information
Lower-order bits
contain subtle details
Intensity = (b7 b6 b5 b4 b3 b2 b1b0)
BP 0 BP 5 BP 7
Bit Plane Slicing (example)
Intensity = (b7 b6 b5 b4 b3 b2 b1b0)
Bit Plane Slicing (plane 1)
Bit Plane Slicing (plane 2)
Bit Plane Slicing (plane 3)
Bit Plane Slicing (plane 4)
Bit Plane Slicing (plane 5)
Bit Plane Slicing (plane 6)
Bit Plane Slicing (plane 7)
Bit Plane Slicing (plane 8)
Bit Plane Slicing (cont)
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
Histogram
Plot of number of occurrences of grey levels against grey level values
0 1 1 3 2 0 3 1 4 1 5 2
Number of Pixels
gray level
Histogram of image
Histogram Examples
Histogram Examples (cont)
Histogram Examples (cont)
Histogram Examples (cont)
Histogram Examples (cont)
High contrast image has the most evenly spaced histogram
Histogram Equalization
Equal number of pixels for every gray-value Histogram is constant Preprocessing technique to enhance contrast in natural images Find gray level transformation function T to transform image f such that the histogram of T(f) is equalized Spreading out the frequencies in an image (or equalising the image) improves dark or washed out images
Equalisation Transformation Function
Histogram Equalisation
rk:input intensity sk:processed intensity k: the intensity range
nj:the frequency of intensity j n: the sum of all frequencies
sk T ( rk )
p j (rj )
j 1 k
j 1
nj n
Histogram Equalisation
Spread out gray levels to evenly distribute
in the range Find cumulative frequency distribution Normalize by dividing by total number of pixels Multiply by maximum gray value Map gray levels
Equalisation Transformation Functions
Histogram Equalization
How does it work ?
Mean value (or average gray level)
m = i ri p(ri) =1*0.3+2*0.1+3*0.2+4*0.1+5*0.2+6*0.1 =2.6
Mean value represents overall brightness
P(r)
0.3 0.2 0.1 0.0
1 2 3 4 5 6 r
Variance
gives a measure of the distribution of
histogram values around the mean
v = 2 = i (ri-m)2 p(ri) M=2.6, v1=(1-2.6)2x0.3+
0.3 0.2 0.1 0.0 0.3 0.2 0.1 0.0
V1 =3.34
V2=0.24
Standard Deviation
A value on the gray level axis, showing average distance of all pixels to the mean = sqrt(v)
0.3 0.2 0.1 0.0
0.3 0.2 0.1 0.0
D1
>
D2
Histograms
Variance and Standard Deviation of the histogram represent average contrast of the image The higher the Variance (=the higher the Standard Deviation), the higher the images contrast
Histograms
Histograms with mean and Standard deviation
M=0.73
D=0.32
M=0.71 D=0.27