Digital Image Processing
Digital Image Processing
Image Transforms
x Image f (x, y)
Point Processing
• The simplest spatial domain operations occur when
the neighbourhood is simply the pixel itself
• In this case T is referred to as a grey level
transformation function or a point processing
operation
• Point processing operations take the form
s=T(r)
• where s refers to the processed image pixel value
and r refers to the original image pixel value
Point Processing Example:
Negative Images
• Negative images are useful for enhancing white or
grey detail embedded in dark regions of an image
• Note how much clearer the tissue is in the negative image
of the mammogram below
Original Negative
Image s = 1.0 - r Image
Image Negation
Point Processing Example:
Negative Images
Original Image Enhanced Image y
y
s = intensitymax - r
Point Processing Example:
Thresholding
• Thresholding transformations are particularly useful for
segmentation in which we want to isolate an object of
interest from a background
Image Thresholding
Point Processing Example:
Thresholding (cont…)
Original Image Enhanced Image y
y
s = log(1 + r)
Log Transformation
Logarithmic Transformations (cont…)
Original Image Enhanced Image y
y
s = log(1 + r)
Power Law Transformations
• Power law transformations have the following form
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
Power Law Transformations (cont…)
Original Image Enhanced Image y
y
s=rγ
• We usually set c to 1
• Grey levels must be in the range [0.0, 1.0]
Power Law Example
Power Law Example (cont…)
γ = 0.6
1
Transformed Intensities
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
Power Law Example (cont…)
Power Law Example (cont…)
γ = 0.4
1
0.9
Transformed Intensities
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
Power Law
Power Law Example Example (cont…)
(cont…)
γ = 0.3
1
0.9
Transformed Intensities
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
Power Law Example (cont…)
• The images to the
right show a
magnetic resonance s = r 0.6
(MR) image of a
fractured human
spine
s = r 0.4
• Different curves
highlight different
detail
γ = 5.0
1
0.9
Transformed Intensities
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
Power Law Transformations (cont…)
• An aerial photo
of a runway is
shown s = r 3.0
• This time
power law
transforms are
s = r 4.0
used to darken
the image
• Different curves
highlight
different detail
Gamma Correction
• Many of you might be familiar with gamma
correction of computer monitors
• Problem is that
display devices do
not respond linearly
to different
intensities
• Can be corrected
using a log
transform
Piecewise Linear Transformation
Functions
• Rather than using a well defined mathematical function
we can use arbitrary user-defined transforms
• The images below show a contrast stretching linear
transform to add contrast to a poor quality image
Contrast Stretching
Gray Level Slicing
• Highlights a specific range of grey levels
• Similar to thresholding
[10000000] [01000000]
[00100000] [00001000]
[00000100] [00000001]
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
Image Histograms
• The histogram of an image shows us the distribution of
grey levels in the image
• Massively useful in image processing, especially in
segmentation
Frequencies
Grey Levels
Histogram Examples
Histogram Examples (cont…)
Histogram Examples (cont…)
Histogram Examples (cont…)
Histogram Examples (cont…)
Histogram Examples (cont…)
Histogram Examples (cont…)
Histogram Examples (cont…)
Histogram Examples (cont…)
Histogram Examples (cont…)
Histogram Examples (cont…)
s T (r ) 0 r L 1
a. T(r) is a strictly monotonically increasing function
in the interval 0 r L -1;
b. 0 T (r ) L -1 for 0 r L -1.
Histogram Equalization
ps (s)ds pr (r )dr
Histogram Equalization
r
s T (r ) ( L 1) pr (w)dw
0
ds dT (r ) d r
dr
dr
( L 1)
dr 0
pr ( w) dw
( L 1) pr (r )
pr (r )dr pr (r ) pr (r ) 1
ps ( s)
ds ds ( L 1) pr (r ) L 1
dr
Histogram Equalization
Continuous case:
r
s T (r ) ( L 1) pr ( w)dw
0
Discrete values:
k
sk T (rk ) ( L 1) pr (rj )
j 0
k nj L 1 k
( L 1) nj k=0,1,..., L-1
j 0 MN MN j 0
Example: Histogram Equalization
Suppose that a 3-bit image (L=8) of size 64 × 64 pixels
(MN = 4096) has the intensity distribution shown in
following table.
0
s0 T (r0 ) 7 pr (rj ) 7 0.19 1.33 1
j 0
1
s1 T (r1 ) 7 pr (rj ) 7 (0.19 0.25) 3.08 3
j 0
s2 4.55 5 s3 5.67 6
s4 6.23 6 s5 6.65 7
s6 6.86 7 s7 7.00 7
Steps for Histogram Equalisation
• Find the running sum of histogram values
• Multiply the values in above step by maximum gray level value and then round-off
Histogram Equalisation Example
• Map the gray level values to the result in previous step using one to one
correspondence
Histogram Equalisation Example
Histogram Equalization
Histogram Equalization
Equalisation Transformation Function
Equalisation Examples
1
Equalisation Transformation Functions
4
Is histogram equalization always good?
z=G-1(T(r))
z s r
desired uniform input
z=G-1(s) s=T(r)
histogram
equalization
histogram
equalization
s=G(z)
Histogram Matching: Procedure
• Obtain pr(r) from the input image and then obtain the
values of s r
s ( L 1) pr (w)dw
0
• Mapping from s to z
z G 1 (s)
Histogram Matching: Discrete Cases
• Obtain pr(rj) from the input image and then obtain the
values of sk, round the value to the integer range [0, L-
1]. k k
( L 1)
sk T (rk ) ( L 1) pr (rj ) nj
j 0 MN j 0
• Mapping from sk to zq
zq G 1 (sk )
Example: Histogram Matching
Example: Histogram Matching
Obtain the scaled histogram-equalized values,
s0 1, s1 3, s2 5, s3 6, s4 7,
s5 7, s6 7, s7 7.
Compute all the values of the transformation function G,
0
G( z0 ) 7 pz ( z j ) 0.00 0
j 0
G ( z1 ) 0.00 0 G ( z2 ) 0.00 0
G ( z3 ) 1.05 1 G ( z4 ) 2.45 2
G ( z5 ) 4.55 5 G ( z6 ) 5.95 6
G ( z7 ) 7.00 7
79
Example: Histogram Matching
Original image and its histogram
• Addition
• Used for superimposing one image on another
• Used to remove noise
• Subtraction
• Used to detect the change
• Multiplication
• Masking operation which can be used for background
suppression
• Division
• Background suppression