Digital Image Processing
Image Enhancement
Differences
Introduction:
NEED FOR ENHANCEMENT
Differences
Image Quality Factors
Contrast
Contrast Refers to Finer details of Image
Contrast
Methods for Computing contrast of an Image
Contrast Manipulation
Brightness
Image Quality Assessment tool
Histograms as assessment tool
Advantages of Histogram
Dynamic Range
Histogram assessment
Image Quality Metrics
Image Quality Metrics
Example
Intensity Transformation Function
Log Transformations
➢ The Log function has the important characteristic that it compresses the
dynamic range of images with large variation in the pixel value.
Classical example is displaying Fourier spectrum.
▪ Fourier spectrum has the values in the range 0 to 1.5x106. These values are
scaled linearly for the display in 8 bit system.
Fourier Log transformation
spectrum with c=1
Intensity Transformation Function
Power-law (Gamma ) Transformations
This has the basic form s=c rγ ,where c and γ are positive constants
Fractional values of γ maps a narrow
range of dark input values into a wider
range of output values. Opposite of this
also true for higher values of input
levels.
These are also called as gamma
correction due to the exponent in the
power law equation.
Plot for c=1
Intensity Transformation Function
Power-law (Gamma ) Transformations
CRT device have an intensity to
voltage response that is a power
function with exponent varying from
approximately 1.8 to 2.5. Such
display system would produce
images that are darker than intended.
Pre-processed image with
gamma correction
s=r =r0.4. before input to
1/2.5
the display device
Intensity Transformation Function
➢Gamma correction is very important
when to reproduce an image exactly
on a display system.
➢ Power-law transformations are also
used in general purpose contrast
manipulation.
close all
clear all;
clc;
[filename, pathname] = uigetfile('*.tif');
im = imread([pathname filename]);
imshow(im);
im1=double(im).^0.3;
im1=mat2gray(im1);
figure,imshow(im1);
Intensity Transformation Function
MRI of Result of a Result of a Result of a
fractured transforma transforma transforma
human tion for tion for tion for
spine γ=0.6 γ=0.4 γ=0.3
Intensity Transformation Function
Arial
Result of a
image
transformation for c=1
and γ=3
Intensity Transformation Function
Result of a Result of a
transformation transformation for
for c=1 and c=1 and γ=5
γ=4
Piecewise Linear transformation functions
Contrast stretching
➢ Low contrast images result from the following
▪ Poor illumination
▪ lack of dynamic range in the imaging sensor
▪ Wrong settings of the lens aperture during acquisition
➢It is a process that expands the range of intensity levels in an image so that it
spans full intensity range of the recording medium or display device
Piecewise Linear transformation functions
Contrast stretching
L-1
Controls the shape of the
(r2,s2) transformation function
output intensity level, s
3L/4
L/2 T(r)
L/4
(r1,s1)
0
0 L/4 L/2 3L/4 L-1
Input intensity level, r
Piecewise Linear transformation functions
Contrast stretching
Suppose r1=s1 and r2=s2
L-1 L-1
(r2,s2)
output intensity level, s
output intensity level, s
3L/4 3L/4 (r2,= s2)
L/2 T(r) L/2 T(r)
L/4 L/4
(r1,=s1)
(r1,s1)
0 0
0 L/4 L/2 3L/4 L-1 0 L/4 L/2 3L/4 L-1
Input intensity level, r Input intensity level, r
Piecewise Linear transformation functions
Contrast stretching
Suppose r1=r2 and s1=0 and s2=L-1
L-1 (r2)
L-1
(r2,s2)
output intensity level, s
output intensity level, s
3L/4 3L/4
L/2 T(r) L/2 T(r)
L/4 L/4
(r1,s1)
0 0 (r1)
0 L/4 L/2 3L/4 L-1 0 L/4 L/2 3L/4 L-1
Input intensity level, r Input intensity level, r
Piecewise Linear transformation functions
Contrast stretching
Intermediate values of (r1,s1) and (r2,s2) produces various degree of spread in
the intensity
L-1
(r2,s2)
output intensity level, s
3L/4
T(r)
L/2
L/4
(r1,s1)
0
0 L/4 L/2 3L/4 L-1
Input intensity level, r
Piecewise Linear transformation functions
Contrast stretching (Example)
(r1,s1)=(rmin, 0) and (r2,s2)=(rmax,L-1)
output intensity level, s L-1
3L/4 rmax,L-1
L/2 T(r)
L/4 rmin, 0
0
0 L/4 L/2 3L/4 L-1
Input intensity level, r
Piecewise Linear transformation functions
Contrast stretching (Example)
POOR CONTRAST IMAGE CONTRAST STRETCHED IMAGE
Piecewise Linear
transformation functions
Contrast stretching (Example)
CONTRAST STRETCHED IMAGE
Piecewise Linear transformation functions
Contrast stretching (Example MATLAB PROGRAM)
close all
clear all;
clc;
[filename, pathname] = uigetfile('*.tif');
im = imread([pathname filename]);
imshow(im);
title('POOR CONTRAST IMAGE');
J = imadjust(im,[0.2 0.5],[0 1]);
figure,imshow(J);
title('CONTRAST STRETCHED IMAGE');
Piecewise Linear transformation functions
Contrast stretching (Example)
close all
clear all;
clc;
[filename, pathname] = uigetfile('*.tif');
im = imread([pathname filename]);
imshow(im);
title('POOR CONTRAST IMAGE');
K=im2bw(im,0.42);
figure,imshow(K)
Piecewise Linear
transformation functions
Contrast stretching (Example)
POOR CONTRAST IMAGE
Piecewise Linear transformation functions
Intensity Level slicing
➢Highlighting specific range of intensities Example :
▪ Enhancing features such as masses of water in the satellite
Imagery.
▪Enhancing flaws in X-ray images.
Piecewise Linear transformation functions
Intensity Level slicing
L-1
T(r)
s
0 r
L-1
Piecewise Linear transformation functions
Intensity Level slicing
L-1
s T(r)
0 r
L-1
Piecewise Linear transformation functions
Intensity Level slicing (Example)
Piecewise Linear transformation functions
Intensity Level slicing (Example)
clear all ;
clc;
[filename, pathname] = uigetfile('*.tif');
im = imread([pathname filename]);
z=double(im);
[row,col]=size(z);
for i=1:1:row
for j=1:1:col
if((z(i,j)>142)) && (z(i,j)<250)
z(i,j)=255;
else
z(i,j)=im(i,j);
end
end
end
figure(1); %-----------Original Image-------------%
imshow(im);
figure(2); %-----------Gray Level Slicing With Background-------------%
imshow(uint8(z));
Piecewise Linear transformation functions
Intensity Level slicing (Example)
Piecewise Linear transformation functions
Intensity Level slicing (Example)
clear all ;
clc;
[filename, pathname] = uigetfile('*.tif');
im = imread([pathname filename]);
z=double(im);
[row,col]=size(z);
for i=1:1:row
for j=1:1:col
if((z(i,j)>142)) && (z(i,j)<250)
z(i,j)=255;
else
z(i,j)=0;
end
end
end
figure(1); %-----------Original Image-------------%
imshow(im);
figure(2); %-----------Gray Level Slicing With Background-------------%
imshow(uint8(z));
Piecewise Linear transformation functions
Bit Plane slicing (Example)
➢ Each pixels are digital number comprising of bits
➢ For a 256 level gray-scale image there are 8 bits for each pixel
➢ We can highlight the contribution of these bits to total image appearance
Example pixel value =135
1
0
0
10000111 0
0
1
1
1
Piecewise Linear transformation functions
Bit Plane slicing (Example)
An 8 bit gray scale
image
Contribution of bit
plane 8
Image Averaging
• A noisy image:
g ( x, y ) = f ( x, y ) + n ( x, y )
• Averaging K different noisy images:
M
1
g ( x, y ) =
K
g ( x, y )
i =1
i
Image Averaging
• As K increases, the variability of the pixel
values at each location decreases.
–This means that g(x,y) approaches f(x,y) as
the number of noisy images used in the
averaging process increases.
• Registering(aligned) of the images is
necessary to avoid blurring in the output
image.
Histogram Modification
✓Histogram modification performs a function
similar to gray level mapping, but works by
considering histogram’s shape and spread.
✓Gray level histogram of an image is the
distribution of the gray levels in an image.
✓Examination of the histogram is one of the
most useful tools for image enhancement, as it
makes easy to see the modifications that may
improve an image.
✓The histogram can be modified by a mapping
function, which will stretch, shrink
(compress), or slide the histogram.
✓Histogram stretching and histogram shrinking
are forms of gray scale modification,
sometimes referred to as histogram scaling.
✓Histogram stretch
• The mapping function equation is as follows:
where: I(r,c)MAX is the largest gray level value in the image
I(r,c), I(r,c)MIN is the smallest gray level value in I(r,c) and
MAX and MIN correspond to the maximum and minimum
gray level values possible (for an 8-bit image these are 0
and 255)
• This equation will take an image and stretch
the histogram across the entire gray level
range, which has the effect of increasing the
contrast of a low contrast image
• If most of the pixel values in an image fall
within a small range, it is useful to allow a
small percentage of the pixel values to be
clipped at the low and high end of the range
(for an 8-bit image this means truncating at 0
and 255)
Histogram Stretching
b) Histogram of image (a)
a) Low-contrast image
d) Histogram of image after stretch
c) Image (a) after histogram stretch
Histogram Stretching with Clipping
a) Original image b) Histogram of original image c)Image after histogram stretching
with out clipping
d) Histogram of image (c) e) Image after histogram stretching with f) Histogram of image (e)
clipping 1% of the values at the high
and low ends
Histogram shrink
✓The mapping function equation is as follows:
where I(r,c)MAX is the largest gray level value in
the image I(r,c), I(r,c)MIN is the smallest gray
level value in I(r,c) and ShrinkMAX and
ShrinkMIN correspond to the maximum and
minimum desired in the compressed histogram.
• Decreases image contrast by compressing the
gray levels.
• However this method may not be useful as an
image enhancement tool, but it is used in an
image sharpening algorithm (unsharp masking)
as a part of an enhancement technique.
Histogram Shrinking
a) Original image b) Histogram of image
c) Image after shrinking the histogram d) Histogram of image (c)
to the range [75,175]
✓ Histogram slide
• Used to make an image either darker or lighter, but
retain the relationship between gray level values
• Accomplished by simply adding or subtracting a
fixed number from all of the gray level values, as
follows:
where the OFFSET value is the amount to slide the histogram
• In this equation we assume that any values
slid past the minimum and maximum values
will be clipped to the respective minimum or
maximum
• A positive OFFSET value will increase the
overall brightness, while a negative OFFSET
will create a darker image
Histogram Slide
a) Resultant image from sliding the b) Histogram of image (a)
histogram down by 50
c) Resultant image from sliding the
d) Histogram of image (c)
histogram up by 50
Histogram Equalization
pr ps
r Histogram s
Equalization
T (.)
dr
p s ( s ) = pr ( r )
ds
ps ( s ) = 1 T (.)
r
s = T (r ) = pr (u )du
0
# pixels with the
j-th gray-level
k k nj
sk = T (rk ) = pr (rj ) = Point operation for
j =0 j =0 MxN equalizing histogram
image size for the example image
87
✓Histogram equalization
• A technique where the histogram of the resultant image is as flat
as possible.
• The theoretical basis for histogram equalization involves
probability theory, where we treat the histogram as the probability
distribution of the gray levels.
• Its function is similar to that of a histogram stretch but often
provides more visually pleasing results across a wider range of
images.
• Consists of four steps:
1. Find the running sum of the histogram values
2. Normalize the values from step (1) by dividing by the total
number of pixels
3. Multiply the values from step (2) by the maximum gray level
value and round
4. Map the gray level values to the results from step (3) using a
one-to-one correspondence
Example:
3-bits per pixel image – range is 0 to 7.
Given the following histogram:
Number of Pixels
Gray Level Value (Histogram values)
0 10
1 8
2 9
3 2
4 14
5 1
6 5
7 2
1) Create a running sum of the histogram values. This
means the first value is 10, the second is 10+8=18,
next 10+8+9=27, and so on. Here we get 10, 18, 27,
29, 43, 44, 49, 51
2) Normalize by dividing by the total number of
pixels. The total number of pixels is:
10+8+9+2+14+1+5+0 = 51 (note this is the last
number from step 1), so we get: 10/51, 18/51, 27/51,
29/51, 43/51, 44/51, 49/51, 51/51
3) Multiply these values by the maximum gray level
values, in this case 7, and then round the result to
the closest integer. After this is done we obtain: 1, 2,
4, 4, 6, 6, 7, 7
4) Map the original values to the results from step 3 by
a one-to-one correspondence. This is done as
follows:
Original Gray Histogram
Level Value Equalized Values
0 1
1 2
2 4
3 4
4 6
5 6
6 7
7 7
▪ All pixels in the original image with gray
level 0 are set to 1, values of 1 are set to 2, 2
set to 4, 3 set to 4, and so on. After the
histogram equalization values are calculated
and can be implemented efficiently with a
look-up-table (LUT), as discussed in Chapter
2
▪ We can see the original histogram and the
resulting histogram equalized histogram in
Fig. 8.2.14. Although the result is not flat, it is
closer to being flat than the original histogram
• Histogram equalization of a digital image will not
typically provide a histogram that is perfectly flat,
but it will make it as flat as possible.
• Histogram equalization may not always provide the
desired effect, since its goal is fixed – to distribute
the gray level values as evenly as possible. To allow
for interactive histogram manipulation, the ability to
specify the histogram is necessary.
Color Image Enhancement
Enhancement of Color Images
• Gray scale transforms and histogram modification
techniques can be applied by treating a color image as three
gray images.
• Care must be taken in how this is done to avoid color shifts.
✓Histogram modification can be performed on
color images, but doing it on each color band
separately can create relative color changes.
✓The relative color can be retained by applying
the gray scale modification technique to one
of the color bands, and then using the ratios
from the original image to find the other
values.
Histogram Equalization of Color Images
a) Original poor contrast image b) Histogram equalization based on
the red color band
Histogram Equalization of Color Images (contd)
c) Histogram equalization based on d) Histogram equalization based on
the green color band the blue color band
Note: In this case the red band gives the best results
This will depend on the image and the desired result
✓Typically the most important color band is
selected, and this choice is very much
application-specific and will not always
provide us with the desired result.
✓Often, we really want to apply the gray
scale modification method to the image
brightness only, even with color images.
✓Histogram modification on color images can
be performed in the following ways:
• Retain the RGB ratios and perform the
modification on one band only, then use the
ratios to get the other two bands’ values, or
• Perform a color transform, such as HSL, do
the modification on the lightness (brightness
band), then do the inverse color transform.
Histogram Matching
• Transform image such that resulting image has specified
histogram.
r Histogram z
Matching
pr F (.) pz
r
s = T (r ) = pr (u )du
z
0
z = G −1 ( s) = G −1[T (r )] F = G −1T
G ( z ) = pz (t )dt = s
0
7/31/2025 118
Histogram Matching
k
sk = T (rk ) = pr (rj )
j =0
k
vk = G( zk ) = pz ( z j ) = sk
j =0
k = 0,1,, L − 1
7/31/2025 119
✓ Histogram Matching
• Process of defining a histogram and modifying
the histogram of the original image to match the
histogram as specified.
• Key concept is to picture the original image
being histogram equalized, and the specified
histogram being histogram equalized.
a
b
• Histogram specification consists of
following 5 steps:
1. Specify the desired histogram
2. Find the mapping table to histogram
equalize the image, Mapping Table 1,
3. Find the mapping table to histogram
equalize the values of the specified
histogram, Mapping Table 2.
• Histogram specification steps (continued)
4. Use mapping Tables 1 & 2 to find the
mapping table to map the original values.
to the histogram equalized values and then to
the specified histogram values.
5. Use the table from step (4) to map the
original values to the specified histogram
values.
EXAMPLE:
1) Specify the desired histogram:
Number of pixels
Gray Level Value in desired histogram
0 1
1 5
2 10
3 15
4 20
5 0
6 0
7 0
2) For this we will use the image and mapping table from
the previous example, where the histogram equalization
mapping table (Mapping Table 1) is given by:
Original Gray Level Value Histogram Equalized
level values-OS equalized values-HS
0 1
1 2
2 4
3 4
4 6
5 6
6 7
7 7
3) Find the histogram equalization mapping table
(Mapping Table 2) for the specified histogram:
Gray Level Histogram Equalized
Value - OS Values – HS .
0 round(1/51)*7 = 0
1 round(6/51)*7 = 1
2 round(16/51)*7 = 2
3 round(31/51)*7 = 4
4 round(51/51)*7 = 7
5 round(51/51)*7 = 7
6 round(51/51)*7 = 7
7 round(51/51)*7 = 7
4) Use Mapping Tables 1 and 2 to find the final mapping
table by mapping the values first to the histogram
equalized values and then to the specified histogram
values. (Mapping Table 2, columns switched to match Fig. 8.2.16 – slide 57)
Mapping Table 1 Mapping Table 2
O H HS OS M
0 1 0 0 1
1 2 1 1 2
2 4 2 2 3
3 4 4 3 3
4 6 7 4 4
5 6 7 5 4
6 7 7 6 4
7 7 7 7 4
5) Use the table from STEP 4 to perform the histogram
specification mapping. For this all we need are columns
O (or OS) and M:
O M
0 1
1 2
2 3
3 3
4 4
5 4
6 4
7 4
Now, all the 0’s get mapped to 1’s, the 1’s to 2’s, the 3’s
to 3’s and so on
• In practice, the desired histogram is often
specified by a continuous (possibly non-
linear) function, for example a sine or a log
function.
• To obtain the numbers for the specified
histogram the function is sampled, the values
are normalized to 1, and then multiplied by
the total number of pixels in the image
Histogram Matching Examples
Original
image
Histogram
of
original
image
Histogram Matching Examples (contd)
Original histogram
Specified histogram, exp(0.015*x)
Output image and its histogram
Histogram Matching Examples (contd)
Original histogram
Specified histogram, log(0.5*x+2)
Output image and its histogram
Image Enhancement in the
Spatial Domain
HOMOMORPHIC FILTERING
• It simultaneously normalizes the brightness
across an image and increases contrast.
• Filtering is used to remove multiplicative noise.
• Illumination and reflectance are not separable.
• Illumination and reflectance combine
multiplicatively.
• Components are made additive by taking the
logarithm of the image intensity.
• Multiplicative components of the image can be separated linearly in
the frequency domain
• To make the illumination of an image more even, the high-frequency
components are increased and low-frequency components are
decreased
• High-frequency components are assumed to represent mostly the
reflectance in the scene (the amount of light reflected off the object
in the scene)
• Low-frequency components are assumed to represent mostly the
illumination in the scene
• High-pass filtering is used to suppress low frequencies and amplify
high frequencies, in the log-intensity domain
• The illumination component tends to vary slowly across
the image.
• The reflectance tends to vary rapidly, particularly at
junctions of dissimilar objects.
• Therefore, by applying a frequency domain filter of the
form we can reduce intensity variation across the image
while highlighting detail.
Homographic filtering : PET example
Spatial filtering
Linear spatial filtering
On continuing ……
Image Smoothing Filter
Variable Weights
Gaussian Filters
Directional Smoothing
Conservative smoothing
• The contra-harmonic mean filter works
well for images containing salt OR pepper
type noise, depending on the filter order,
R:
• For negative values of R, it eliminates salt-
type noise, while for positive values of R, it
eliminates pepper-type noise
• The geometric mean filter works best
with Gaussian noise, and retains detail
information better than an arithmetic mean
filter
• It is defined as the product of the pixel
values within the window, raised to the
1/(N*N) power:
• The harmonic mean filter fails with pepper
noise, but works well for salt noise
• It is defined as follows:
• This filter also works with Gaussian noise,
retaining detail information better than the
arithmetic mean filter
• The Yp mean filter is defined as follows:
• This filter removes salt noise for negative values of P,
and pepper noise for positive values of P
Median Filter
a) Image with added salt-and-pepper noise, b) After median filtering with a 3x3
the probability for salt = probability window,all the noise is not removed
for pepper = 0.10
Median Filter
c) After median filtering with a 5x5 window, all the noise is
removed, but the image is blurry acquiring the “painted”
effect
Sharpening Filters
High-Boost Filter
Unsharp Masking
Examples of Unsharp masking
Image Enhancement in the Frequency Domain
Origin = 0,0
2D Discrete Fourier Transform
f(x,y) F(u,v) – not centered
Centered + Log
Centered F(u,v) Transformed F(u,v)
Origin = 0,0
Image Enhancement in the Frequency Domain
2D Discrete Fourier Transform
Consider the following 2 left images which are pure vertical cosine of 4 cycles and a pure
vertical cosine of 32 cycles.
f(x,y) F(u,v) Notice that the Fourier Spectrum for
each image at the right contains just a
single component, represented by 2
bright spots symmetrically placed
about the center.
The dot at the center that represents
f(x,y) F(u,v) the (0,0) frequency term or average
value of the image. Images usually
have a large average value/DC
component. Due to low frequencies
Fourier Spectrum images usually
have a bright blob of components near
the center.
© 2002 R. C. Gonzalez & R. E. Woods
Image Enhancement in the Frequency Domain
2D Discrete Fourier Transform
Consider the following 2 left images with pure cosines in pure forward diagonal and mixed
vertical+horizontal.
f(x,y) F(u,v)
One of the properties of the 2D
FT is that if you rotate the
image, the spectrum will rotate
in the same direction.
f(x,y) F(u,v)
The sum of 2 sine functions, each
in opposite (vertical and
horizontal) direction.
© 2002 R. C. Gonzalez & R. E. Woods
Image Enhancement in the Frequency Domain
2D Discrete Fourier Transform
The center value (at the origin) of the Frequency Spectrum corresponds to the ZERO
frequency component which also referred to as the DC component in an image:
Substituting 0,0 to the origin, the Fourier transform function yields to the average/DC
component value as follows: M −1N −1
1
F(0,0) =
MN
f (x, y)
f(x,y) F(u,v) x=0 y=0 f(x,y) F(u,v)
The center/zero frequency
component (DC component) is
removed
f(x,y) F(u,v)
(Average image) (DC Component)
© 2002 R. C. Gonzalez & R. E. Woods
Image Enhancement in the Frequency Domain
2D Discrete Fourier Transform
f(x,y) F(u,v)
The lines in an image often
generate perpendicular lines
in the spectrum.
f(x,y) F(u,v)
The sloped lines in the
spectrum are due to the sharp
transition from the sky to the
mountain
© 2002 R. C. Gonzalez & R. E. Woods
Image Enhancement in the Frequency Domain
Filtering in the Frequency Domain
•Some Basic Properties of the Frequency Domain:
•Frequency is directly related to the rate of change. Therefore, slowest varying
component (u=v=0) corresponds to the average intensity level of the image.
Corresponds to the origin of the Fourier Spectrum.
f(x,y)
•Higher frequencies corresponds to the faster
varying intensity level changes in the image. The
edges of objects or the other components
characterized by the abrupt changes in the
intensity level corresponds to higher frequencies.
F(u,v)
Prepared By: Dr. Hasan Demirel, PhD
© 2002 R. C. Gonzalez & R. E. Woods
Image Enhancement in the Frequency Domain
Filtering in the Frequency Domain
•Basic Steps for Filtering in the Frequency Domain:
Prepared By: Dr. Hasan Demirel, PhD
© 2002 R. C. Gonzalez & R. E. Woods
Image Enhancement in the Frequency Domain
Filtering in the Frequency Domain
•Basic Steps for Filtering in the Frequency Domain:
1. Multiply the input image by (-1)x+y to center the transform.
2. Compute F(u,v), the DFT of the image from (1).
3. Multiply F(u,v) by a filter function H(u,v).
4. Compute the inverse DFT of the result in (3).
5. Obtain the real part of the result in (4).
6. Multiply the result in (5) by (-1)x+y .
Given the filter H(u,v) (filter transfer function) in the frequency domain, the Fourier
transform of the output image (filtered image) is given by:
G(u, v) = H (u, v)F(u, v) Step (3)
The filtered image g(x,y) is simply the inverse Fourier transform of G(u,v).
g(x, y) = −1 G(u, v) Step (4)
Image Enhancement in the Frequency Domain
Filtering in the Frequency Domain
•Basics of Low Pass Filters in the Frequency Domain:
•lowpass filter: A filter that attenuates
high frequencies while passing the low
frequencies.
•Low frequencies represent the gray-
level appearance of an image over
smooth areas.
•highpass filter: A filter that attenuates
low frequencies while passing the high
frequencies.
•High frequencies represents the details
such as edges and noise.
Image Enhancement in the Frequency Domain
Filtering in the Frequency Domain
•Consider the following filter transfer function:
0 if (u, v) = (M / 2, N / 2)
H (u, v) =
1 otherwise
•This filter will set F(0,0) to zero and leave all the other frequency components. Such a
filter is called the notch filter, since it is constant function with a hole (notch) at the origin.
Image Enhancement in the Frequency Domain
Filtering in the Frequency Domain
• Smoothing Frequency Domain Filters: Ideal Lowpass Filters
1 if D(u, v) D0
H (u, v) = D(u,v) is the distance from the origin
0 if D(u, v) D0 D0is the cutoff frequency
Image Enhancement in the Frequency Domain
Filtering in the Frequency Domain
• Smoothing Frequency Domain Filters: Butterworth Lowpass Filters
1 D(u,v) is the distance from the origin
H (u, v) = D0 is the cutoff frequency.
1+[D(u, v) / D0 ]2n
n is the order of the filter
Image Enhancement in the Frequency Domain
Filtering in the Frequency Domain
• Smoothing Frequency Domain Filters: Gaussian Lowpass Filters
− D2 (u,v)/ 2D 02 D(u,v) is the distance from the origin
H (u, v) = e D0 is the cutoff frequency.
Image Enhancement in the Frequency Domain
Filtering in the Frequency Domain
•Comparison of Ideal, Butterworth and Gaussian Lowpass Filters having the
same radii (cutoff frequency) value.
Original image Ideal LP Filtered Butterworth LP Filtered Gaussian LP Filtered
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
• The high-frequency components are: edges and sharp transitions such as noise.
•Smoothing/blurring can be achieved by attenuating a specified range of high-
frequency components in the frequency domain.
•Given the Fourier transformed image F(u) , the filtered image G(u) can be
obtained by:
G(u, v) = H (u, v)F(u, v)
•Where H(u) is the filter transfer function.
•Smoothing can be achieved by lowpass filters. We will consider only 3 types of
lowpass filters:
•Ideal Lowpass filters,
•Butterworth Lowpass filters,
•Gaussian Lowpass filters
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
•Ideal Lowpass Filter (ILPF): Simply cuts off all the high frequencies higher
than the specified cutoff frequency. The filter transfer function:
1 if D(u, v) D0 D(u,v) is the distance from the origin
H (u, v) = D0is the cutoff frequency
0 if D(u, v) D0
Cutoff frequency
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
•Cutoff Frequency of an Ideal Lowpass Filter: One way of specifying the
cutoff frequency is to compute circles enclosing specified amounts of total image
power.
•Calculating PT which is the total power of the transformed image:
M −1 N −1
PT= P(u, v) u = 0, 1, ..., M − 1 , v = 0, 1, ..., N − 1
u=0 v=0
•The cutoff frequency Do can be determined by specifying
the percent of the total power enclosed by a circle
centered at the origin. The radius of the circle is the cutoff
frequency Do.
= 100 P(u, v) / PT u radius( D o) , v radius( D o)
u v
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
• Cutoff Frequency of an Ideal Lowpass Filter:
Original Image Fourier Spectrum 15 pixels , = 92%
80 pixels , = 98%
230 pixels ,
= 99.5%
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
• Cutoff Frequency of an Ideal Lowpass Filter:
ILPF with cutoff=5, removed power=8%
Blurring effect is the result of LPIF
Original
Image
ILPF with cutoff=30, removed power=3.6%
cutoff=15,
r.d. power=5.4% Ringing effect is the problem of LPIF
ILPF with cutoff=230, removed power=0.5%
cutoff=80,
r.d. power=2%
Image Enhancement in the Frequency Domain
• G(u, v) = H (u, v)F(u, v)
• The corresponding process in the spatial domain with regard to the convolution
• theorem is given by:
• g(x, y) = h(x, y) f (x, y)
• h(x,y) in the spatial domain, is the inverse Fourier transform of the filter transfer
function H(u,v).
Smoothing Frequency-Domain Filters
•Blurring and Ringing properties of ILPF:
•The blurring and ringing properties of the ILPF can be explained by the help of
the convolution theorem:
•Given the Fourier transformed input image F(u) and output image G(u) and
the filter transfer function H(u),
•The spatial filter h(x,y) has two major characteristics:
• dominant component at the origin
•Concentric circular components about center component.
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
• Blurring and Ringing properties of ILPF:
1D Frequency Domain- H(u) 1D Spatial Domain- h(x)
inverse DFT
2D Frequency Domain- H(u,v) 2D Spatial Domain – h(x,y)
•The spatial domain filters center component is responsible for blurring.
•The circular components are responsible for the ringing artifacts.
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
•Blurring and Ringing properties of ILPF: Lets consider the following
convolution in the spatial domain:
Central components: causes blurring
* =
circular components: causes ringing effect
Input image - f(x,y) Spatial Filter – h(x,y) filtered image – g(x,y)
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
•Butterworth Lowpass Filter (BLPF): The transfer function of BLPF of
order n and with a specified cutoff frequency is denoted by the following filter
transfer function:
1
H (u, v) = D(u,v) is the distance from the origin
D0 is the cutoff frequency.
1+[D(u, v) / D0 ]2n n is the order of the filter
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
• Butterworth Lowpass Filter (BLPF):
•The BLPF with order of 1 does not have any ringing artifact.
•BLPF with orders 2 or more shows increasing ringing effects as the order
increases.
D0 =5, n=1 D0 =5, n=2 D0 =5, n=3 D0 =5, n=4
2D - Spatial domain representation of the BLPF.
1D - Profile through the centre of the Spatial domain filters.
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
•Butterworth Lowpass Filter (BLPF):
BLPF with cutoff=5, order=2
Original Image
cutoff=15, BLPF with cutoff=30, order=2
order=2
BLPF with cutoff=230, order=2
cutoff=80,
order=2
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
•Gaussian Lowpass Filter (GLPF): The transfer function of GLPF is given as
follows:
2
− D 2 (u,v)/ 2D 0
H (u, v) = e
D(u,v) is the distance from the origin
D0 is the cutoff frequency.
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
•(GLPF): The inverse Fourier transform of the Gaussian Lowpass
cutoff=5 filter is also Gaussian in the Spatial
domain.
Original
Image
•Therefore there is no ringing effect
of the GLPF. Ringing artifacts are
cutoff=15 cutoff=30 not acceptable in fields
like medical imaging. Hence use
Gaussian instead of the
ILPF/BLPF.
cutoff=230
cutoff=80
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
•Gaussian Lowpass Filter (GLPF): Refer to the improvement in the following
example.
Image Enhancement in the Frequency Domain
Smoothing Frequency-Domain Filters
•Gaussian Lowpass Filter (GLPF): The following example shows a lady
younger. How? By using GLPF!
Image Enhancement in the Frequency Domain
Sharpening Frequency-Domain Filters
•The high-frequency components are: edges and sharp transitions such as noise.
•Sharpening can be achieved by highpass filtering process, which attenuates low
frequency components without disturbing the high-frequency information in the
frequency domain.
•The filter transfer function, Hhp(u,v), of a highpass filter is given by:
Hhp (u, v) = 1− Hlp (u, v)
•Where Hlp(u,v), is the transfer function of the corresponding lowpass filter.
•We will consider only 3 types of sharpening highpass filters :
•Ideal Highpass filters,
•Butterworth Highpass filters,
•Gaussian Highpass filters
Image Enhancement in the Frequency Domain
Sharpening Frequency-Domain Filters
•Ideal Highpass Filter (IHPF): Simply cuts off all the low frequencies lower
than the specified cutoff frequency. The filter transfer function:
0 if D(u, v) D0 D(u,v) is the distance from the origin
H (u, v) = D0is the cutoff frequency
1 if D(u, v) D0
Perspective plot Image representation Cross section of
of IHPF of IHPF IHPF
Image Enhancement in the Frequency Domain
Sharpening Frequency-Domain Filters
•Ideal Highpass Filter (IHPF): The ringing artifacts occur at low cutoff
frequencies
D0 =15 D0 =30 D0 =80
Image Enhancement in the Frequency Domain
Sharpening Frequency-Domain Filters
•Butterworth Highpass Filter (BHPF): The transfer function of BHPF of
order n and with a specified cutoff frequency is given by:
1 D(u,v) is the distance from the origin
H (u, v) = D0 is the cutoff frequency.
1+[D0 / D(u, v)]2n n is the order of the filter
Perspective plot Image representation Cross section of
of BHPF of BHPF BHPF
Image Enhancement in the Frequency Domain
Sharpening Frequency-Domain Filters
•Butterworth Highpass Filter (BHPF): Smoother results are obtained in
BHPF when compared IHPF. There is almost no ringing artifacts.
D0 =15, n=2 D0 =30, n=2 D0 =80, n=2
Sharpening Frequency-Domain Filters
•Gaussian Highpass Filter (GHPF): The transfer function of GHPF is given
by:
2 D(u,v) is the distance from the origin
−D 2 (u,v)/ 2D 0
H (u, v) = 1− e D0 is the cutoff frequency.
Perspective plot Image representation Cross section of
of BHPF of BHPF BHPF
Image Enhancement in the Frequency Domain
Sharpening Frequency-Domain Filters
•Gaussian Highpass Filter (GHPF): Smoother results are obtained in GHPF
when compared BHPF. There is absolutely no ringing artifacts.
D0 =15 D0 =30 D0 =80
Image Enhancement in the Frequency Domain
Sharpening Frequency-Domain Filters
•Comparison of Ideal, Butterworth and Gaussian High pass Filters
(D0 =30)
Ideal High pass Filter Butterworth High pass Filter Gaussian High pass Filter
Thank You