2/3/2025
Image Enhancement
• To process an image so that the result is
Image Enhancement in the Spatial more suitable than the original image for a
Domain specific application.
• Processing Techniques are very much
problem oriented
• Best technique for enhancing x-ray image
may not be best for microscopic images
Categories of Enhancement Techniques Spatial Domain Techniques
G (x, y) = T [f (x, y)]
Spatial domain Techniques – f (x, y): input image,
Spatial domain techniques are techniques -G (x, y): processed image
that operate directly on pixels. – T: an operator on f defined over a
Frequency domain Techniques neighborhood of point (x,y)
Frequency domain techniques are based (x,y): any arbutrary location in the image
on modifying the Fourier transform of an
image.
1
2/3/2025
• Suppose that neighborhood is a square of
size 3x3, and that operator T is defined as
“ compute the average intensity of the
neighborhood”. Consider any arbitrary
location in an image and perform the
operation.
Point Operation
Mask Operation
2
2/3/2025
Point Processing
Image Histogram
• s=T(r)
• r: gray-level at (x,y) in original image f(x,y)
• H(rk) = nk • s: gray-level at (x,y) in processed image g(x,y)
• T is called gray-level transformation or mapping
• P(rk) = nk/n k = 0,……L-1
• Contrast Stretching: to get an image with higher contrast than the original image
• The gray levels below m are darkened and the levels above m are brightened .
Contrast Stretching
3
2/3/2025
Lazy man operation Image Negative
V
u
0 L u
0 L
Input Image Transformation Output Image Input Image Transformation Output Image
Contrast Stretching Clipping
v v
yb
yb
ya
a b u
a b u
Input Image Transformation Output Image
Input Image Transformation Output Image
4
2/3/2025
Thresholding
v
225
128 u
Input Image
Transformation Output Image
5
2/3/2025
Cancer Region
Dynamic range compression
Fourier spectrum has large dynamic range of pixel value( from 0 to 106)
• If γ <1: maps a narrow range of dark input values into a wider range of output values.
Result of log transformation
• If γ >1:opposite of the above effect.
Dynamic range has been compressed from 0 to 6.2 with C=1 for display
purpose . • The process used to correct this power-low response phenomena is called gamma
correction.
6
2/3/2025
CRT devices have an intensity to voltage response that is a power function with
exponents varying from 1.8 to 2.5
7
2/3/2025
Contrast Stretching Gray-level Slicing
8
2/3/2025
Bit-plane Slicing
• Higher order bit planes of an image carry a
significant amount of visually relevant details.
• Lower order planes contribute more to fine
(often imperceptible) details.
9
2/3/2025
10
2/3/2025
Histogram Processing
Normalised Histogram
• Histogram is a discrete function formed by counting
the number of pixels that have a certain gray level
in the image .
• In an image with gray levels in [0,L-1], the histogram
is given by p(rk)= nk/n where:
– rk is the kth gray level, k=0, 1, 2, …, L-1
– nk number of pixels in the image with gray level rk
– n total number of pixels in the image
• Loosely speaking, p(rk) gives an estimate of the
probability of occurrence of gray level rk.
11
2/3/2025
12
2/3/2025
13
2/3/2025
• (A’) T(r) is a strictly monotonically
incresing function in the interval 0≤r ≤L-1
for r=t-1(s)
An Example
• An input image PDF is as
• Find the transformation function to get
histogram equalized image and also prove
that image obtained by using such
transformation function will have high
contrast.
14
2/3/2025
15
2/3/2025
Example:
• Assuming continuous intensity values,
suppose that intensity PDF
• Find the transformation function that will
produce an image whose intensity PDF is
Steps in Discrete histogram
matching
1. Compute the histogram pr(r) of the image, 2. Compute all values of the transformation
and se it to find the histogram equalization function G using the equation
transformation in equation
For q= 0,1,2,3,….,L-1, where pz(zi) are the
• Round the resulting values, sk , to the values of the specified histogram. Round
integer range [0,L-1]. the values of G to integers in the range
[0,L-1]. Store the values of G in a table.
16
2/3/2025
4. Form the histogram specified image by first
histogram equalizing the input image and then
mapping every equalized pixel value, sk of this
3. For every value of sk, k=0,1,2,…….,L-1. image to the corresponding value Zq in the
use the stored value of G from step 2 to histogram specified image using the mapping
found in step 3.
find the corresponding value of zq so that
G(zq) is closest to sk and store these As in the continuous case, the intermediate step
of equalizing the input image is conceptual. It
mappings from s to z . can be skipped by combining the two
transformation functions, T and G-1.
when more than one value of zq satisfies
the given sk(i.e. mapping is not unique)
choose the smallest value by convention.
Given an 64 x 64 image with histogram as
The first step in the procedure is to obtain the scaled
histogram-equalized values using
• s0=1
• s1=3
• s2=5
It is desired to transform this histogram so that it will have the values
specified in the second column of table and histogram shown below • s3=6
• s4=7
• s5=7
• s6=7
• s7=7
17
2/3/2025
These values converted to integer in the valid range [0,7]
In the next step we compute all the values of the
transformation function G, using
• G(z0)=0.00 • G(z0)=0.00 =0
• G(z1)=0.00 • G(z1)=0.00 =0
• G(z2)=0.00 • G(z2)=0.00 =0
• G(z3)=1.05 • G(z3)=1.05 =1
• G(z4)=2.45 • G(z4)=2.45 =2
• G(z5)=4.55 • G(z5)=4.55 =5
• G(z6)=5.95 • G(z6)=5.95 =6
• G(z7)=7.00 • G(z7)=7.00 =7
Since G is not strictly monotonically increasing therefore step-3 is used
In the final step use mapping of the table given below
• We find the smallest value of zq so that the
value G(zq) is closest to sk .
• Do this for every value of sk to creat the
required mapping from s to z.
• Example : s0 = 1 and G(z3)=1 thus s0= z3 • The value of the resulting histogram is in third column of
the table
i.e. every pixel whose value is 1 in histogram • And histogram is as
equalized image would map to pixel value
3 (in the corresponding location) in
histogram specified image.
18
2/3/2025
19
2/3/2025
20