0% found this document useful (0 votes)
7 views93 pages

Module 21

The document presents an overview of digital image processing, focusing on image enhancement techniques in the spatial domain. It discusses various methods such as contrast stretching, thresholding, and histogram equalization, emphasizing their applications and effects on image quality. The content is structured around the principles of manipulating pixel values to improve image suitability for specific applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views93 pages

Module 21

The document presents an overview of digital image processing, focusing on image enhancement techniques in the spatial domain. It discusses various methods such as contrast stretching, thresholding, and histogram equalization, emphasizing their applications and effects on image quality. The content is structured around the principles of manipulating pixel values to improve image suitability for specific applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 93

Dr.

Justin Varghese Slide 1


19ECS352: IMAGE PROCESSING

Digital Image Processing

Justin Varghese, Ph.D. (Eng.), SM IEEE


Professor,
Department of Computer Science & Engineering,
Gitam (Deemed to be University)
GST, Bangalore Campus
Mobile: +91-9940955156
Email: [email protected], [email protected]

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 2
19ECS352: IMAGE PROCESSING

Image Enhancement in the Spatial Domain

Principle Objective of Enhancement

Process an image so that the result will be more suitable than the original
image for a specific application.
The suitableness is up to each application.
A method which is quite useful for enhancing an image may not
necessarily be the best approach for enhancing another images

2 domains
• Spatial Domain : (image plane)
– Techniques are based on direct manipulation of pixels in an image
– Procedures that operate directly on pixels
• Frequency Domain :
– Techniques are based on modifying the Fourier transform of an image
• There are some enhancement techniques based on various combinations of
methods from these two categories.

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 3
19ECS352: IMAGE PROCESSING

Good images

• For human visual


– The visual evaluation of image quality is a highly subjective process.
– It is hard to standardize the definition of a good image.

• For machine perception


– The evaluation task is easier.
– A good image is one which gives the best machine recognition results.

• A certain amount of trial and error usually is required before a particular image
enhancement approach is selected.

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 4
19ECS352: IMAGE PROCESSING

Pont Processing

• Procedures that operate directly on pixels.

• g(x,y) = T[f(x,y)]
– where
– f(x,y) is the input image
– g(x,y) is the processed image
– T is an operator on f defined over f(x,y)

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 5
19ECS352: IMAGE PROCESSING

Image Negatives
• An image with gray level in the range [0,
Negative L-1]
nth root where L = 2n ; n = 1, 2…
Log • Negative transformation :
nth power
s = L – 1 –r
• Reversing the intensity levels of an image.
• Suitable for enhancing white or gray detail
Identity Inverse Log
embedded in dark regions of an image,
especially when the black area dominant in
Input gray level, r size.

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 6
19ECS352: IMAGE PROCESSING

Example of Negative Image

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 7
19ECS352: IMAGE PROCESSING

Contrast Stretching

• Produce higher contrast than the


original by
– darkening the levels below m in
the original image
– Brightening the levels above m in
the original image

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 8
19ECS352: IMAGE PROCESSING

Contrast Stretching

• increase the dynamic range of the


gray levels in the image
• (b) a low-contrast image : result from
poor illumination, lack of dynamic
range in the imaging sensor, or even
wrong setting of a lens aperture of
image acquisition
• (c) result of contrast stretching:
(r1,s1) = (rmin,0) and (r2,s2) =
(rmax,L-1)
• (d) result of thresholding

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 9
19ECS352: IMAGE PROCESSING

Thresholding
• Produce a two-level (binary) image

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 10
19ECS352: IMAGE PROCESSING

3 basic gray-level transformation functions


• Linear function
Negative
nth root – Negative and identity
Log
transformations
nth power
• Logarithm function
– Log and inverse-log
transformation
Identity Inverse Log
• Power-law function
Input gray level, r – nth power and nth root
transformations

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 11
19ECS352: IMAGE PROCESSING

Identity function
• Output intensities are identical to
Negative
nth root input intensities.
Log nth power • Is included in the graph only for
completeness.
Identity Inverse Log

Input gray level, r

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 12
19ECS352: IMAGE PROCESSING

Log Transformations
s = c log (1+r)
Negative
nth root • c is a constant
Log and r  0
nth power
• Log curve maps a narrow range of low
gray-level values in the input image
into a wider range of output levels.
Identity Inverse Log • Used to expand the values of dark
pixels in an image while compressing
Input gray level, r
the higher-level values.

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 13
19ECS352: IMAGE PROCESSING

Log Transformations
• It compresses the dynamic range of images with large variations in pixel values
• Example of image with dynamic range: Fourier spectrum image
• It can have intensity range from 0 to 106 or higher.
• We can’t see the significant degree of detail as it will be lost in the display.

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 14
19ECS352: IMAGE PROCESSING

Example of Logarithm Image

Fourier Spectrum with Result after apply the log


range = 0 to 1.5 x 106 transformation with c = 1,
range = 0 to 6.2

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 15
19ECS352: IMAGE PROCESSING

Power-Law Transformations
s = cr
• c and  are positive constants
• Power-law curves with fractional
values of  map a narrow range of
dark input values into a wider range
of output values, with the opposite
being true for higher values of input
Input gray level, r levels.
Plots of s = cr for various values of  • c =  = 1  Identity function
(c = 1 in all cases)

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 16
19ECS352: IMAGE PROCESSING

Gray-level slicing

• Highlighting a specific range of gray


levels in an image
– Display a high value of all gray
levels in the range of interest and
a low value for all other gray
levels
• (a) transformation highlights range
[A,B] of gray level and reduces all
others to a constant level
• (b) transformation highlights range
[A,B] but preserves all other levels

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 17
19ECS352: IMAGE PROCESSING

Bit-plane slicing

Bit-plane 7 • Highlighting the contribution made to total


One 8-bit byte
(most significant) image appearance by specific bits
• Suppose each pixel is represented by 8 bits
• Higher-order bits contain the majority of
the visually significant data
Bit-plane 0 • Useful for analyzing the relative
(least significant) importance played by each bit of the image

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 18
19ECS352: IMAGE PROCESSING

Example

• The (binary) image for bit-plane 7


can be obtained by processing the
input image with a thresholding
gray-level transformation.
– Map all levels between 0 and
127 to 0
– Map all levels between 129 and
255 to 255
An 8-bit fractal image

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 19
19ECS352: IMAGE PROCESSING

8 bit planes

Bit-plane Bit-plane
7 6
Bit- Bit- Bit-
plane plane plane
5 4 3
Bit- Bit- Bit-
plane plane plane
2 1 0

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 20
19ECS352: IMAGE PROCESSING

Histogram Processing
• Histogram of a digital image with gray levels in the range [0,L-1] is a discrete
function
• h(rk) = nk
• Where
– rk : the kth gray level
– nk : the number of pixels in the image having gray level rk
– h(rk) : histogram of a digital image with gray levels rk

Normalized Histogram
• dividing each of histogram at gray level rk by the total number of pixels in the
image, n
• p(rk) = nk / n
• For k = 0,1,…,L-1
• p(rk) gives an estimate of the probability of occurrence of gray level rk
• The sum of all components of a normalized histogram is equal to 1

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 21
19ECS352: IMAGE PROCESSING

Histogram Processing h(rk) or p(rk)

• Basic for numerous spatial domain processing techniques


rk
• Used effectively for image enhancement
• Information inherent in histograms also is useful in image compression and
segmentation

Example
Components of histogram are
Dark image concentrated on the low side of the
gray scale.

Bright image Components of his


gram are concentrated on the high
side of the gray scale.

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 22
19ECS352: IMAGE PROCESSING

Example

Low-contrast image
histogram is narrow and centered
toward the middle of the gray scale
High-contrast image
histogram covers broad range of the gray scale
and the distribution of pixels is not too far from
uniform, with very few vertical lines being much
higher than the others
Histogram Equalization
• As the low-contrast image’s histogram is narrow and centered toward the middle
of the gray scale, if we distribute the histogram to a wider range the quality of the
image will be improved.
• We can do it by adjusting the probability density function of the original histogram
of the image so that the probability spread equally

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 23
19ECS352: IMAGE PROCESSING

Histogram Equalization
• The probability of occurrence of gray level in an image is approximated by

nk
pr ( rk ) = where k = 0 , 1, ..., L- 1
n
• The discrete version of transformation

k
sk = T ( rk ) =  pr ( r j )
j =0
k nj
= where k = 0 , 1, ..., L-1
j =0 n

Histogram Equalized image hi(i,j)=Sk*(L-1)

Department of Computer Science & Engineering


2
/
4 Dr. Justin Varghese Slide 24
3
19ECS352: IMAGE PROCESSING
/
2
0
Histogram Equalization
2
5

Continuous case:
s = T (r ) = ( L − 1)  pr ( w)dw
r

Discrete values:
k
sk = T (rk ) = ( L − 1) pr (rj )
j =0
knj L −1 k
= ( L −1) =  nj k=0,1,..., L-1
j =0 MN MN j =0

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 25
19ECS352: IMAGE PROCESSING

Histogram Equalization

• Thus, an output image is obtained by mapping each pixel with level rk in the input
image into a corresponding pixel with level sk in the output image
• In discrete space, it cannot be proved in general that this discrete transformation
will produce the discrete equivalent of a uniform probability density function,
which would be a uniform histogram

Example
Histogram
before after
equalization

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 26
19ECS352: IMAGE PROCESSING
Example

before after Histogram


equalization

The quality is not


improved much
because the original
image already has a
broaden gray-level
scale

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 27
19ECS352: IMAGE PROCESSING

Example
No. of pixels

2 3 3 2
4 2 4 3 6

5
3 2 3 5
4
2 4 2 4 3

2
4x4 image
1
Gray level
Gray scale = [0,9]
0 1 2 3 4 5 6 7 8 9

histogram
Department of Computer Science & Engineering
Dr. Justin Varghese Slide 28
19ECS352: IMAGE PROCESSING

Gray
0 1 2 3 4 5 6 7 8 9
Level(j)

No. of
0 0 6 5 4 1 0 0 0 0
pixels

n
j =0
j 0 0 6 11 15 16 16 16 16 16

nk 6 11 15 16 16 16 16 16
s= j 0 0 / / / / / / / /
j =0 n
16 16 16 16 16 16 16 16

3.3 6.1 8.4


sx9 0 0 9 9 9 9 9
3 6 8

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 29
19ECS352: IMAGE PROCESSING

Example

No. of pixels

6
3 6 6 3
5
8 3 8 6 4

6 3 6 9 3

2
3 8 3 8
1

Output image
0 1 2 3 4 5 6 7 8 9
Gray scale = [0,9] Gray level
Histogram equalization
Department of Computer Science & Engineering
Dr. Justin Varghese Slide 30
19ECS352: IMAGE PROCESSING

Enhancement using Arithmetic/Logic Operations

Arithmetic/Logic operations perform on pixel by pixel basis between two or more


images
except NOT operation which perform only on a single image

Logic Operations

Logic operation performs on gray-level images, the pixel values are processed as
binary numbers
light represents a binary 1, and dark represents a binary 0
NOT operation = negative transformation

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 31
19ECS352: IMAGE PROCESSING

Example of AND Operation

original image AND image result of AND


mask operation

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 32
19ECS352: IMAGE PROCESSING

Example of OR Operation

original image OR image result of OR operation


mask

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 33
19ECS352: IMAGE PROCESSING

Image Subtraction
g(x,y) = f(x,y) – h(x,y)

a). original fractal image


b). result of setting the four lower-order bit
planes to zero refer to the bit-plane slicing
the higher planes contribute significant
detail
the lower planes contribute more to fine
detail
image

a b
c d
Department of Computer Science & Engineering
Dr. Justin Varghese Slide 34
19ECS352: IMAGE PROCESSING

Spatial Filtering

use filter (can also be called as mask/kernel/template or window)


the values in a filter subimage are referred to as coefficients, rather
than pixel.
our focus will be on masks of odd sizes, e.g. 3x3, 5x5,…

Spatial Filtering Process


simply move the filter mask from point to point in an image.
at each point (x,y), the response of the filter at that point is calculated using a
predefined relationship.

R = w1 z1 + w2 z2 + ...+ wmn zmn


mn
=  wi zi
i =i

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 35
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 36
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 37
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 38
19ECS352: IMAGE PROCESSING

Linear Filtering

•Linear Filtering of an image f of size MxN filter mask of size mxn is given by the

expression

a b
g ( x, y) =   w(s, t ) f ( x + s, y + t )
t =− a t =−b

• where a = (m-1)/2 and b = (n-1)/2

• To generate a complete filtered image this equation must be applied for x = 0, 1, 2, …


, M-1 and y = 0, 1, 2, … , N-1

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 39
19ECS352: IMAGE PROCESSING

Smoothing Spatial Filters


used for blurring and for noise reduction
blurring is used in preprocessing steps, such as
removal of small details from an image prior to object extraction
bridging of small gaps in lines or curves
noise reduction can be accomplished by blurring with a linear filter and also by a
nonlinear filter

Smoothing Linear Filters

output is simply the average of the pixels contained in the neighborhood of the filter
mask called averaging filters or lowpass filters.
replacing the value of every pixel in an image by the average of the gray levels in the
neighborhood will reduce the “sharp” transitions in gray levels.
sharp transitions
random noise in the image
edges of objects in the image
thus, smoothing can reduce noises (desirable) and blur edges (undesirable)

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 40
19ECS352: IMAGE PROCESSING

3x3 Smoothing Linear Filters

box filter weighted average


the center is the most important and other pixels are
inversely weighted as a function of their distance from
the center of the mask

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 41
19ECS352: IMAGE PROCESSING

Filtering / Mask Processing


In general, linear filtering of an image f of size M*N with a filter
mask of size m*n is given by the expression:

Convolution and correlation

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 42
19ECS352: IMAGE PROCESSING
Convolution Example
1 5 10 10
5 1 5 10 5 7
10 10 5 10 5 6
1 1 10 5
Out(2,2)= (1/9)*(1+5+10+5+1+5+10+10+5)=52/9=5.77
Out(2,3)= (1/9)*(5+10+10+1+5+10+10+5+10)=66/9=7.33

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 43
19ECS352: IMAGE PROCESSING

Weighted average filter

•the basic strategy behind weighting the center point the highest and then
reducing the value of the coefficients as a function of increasing distance from the
origin is simply an attempt to reduce blurring in the smoothing process.

General form : smoothing mask

•filter of size mxn (m and n odd)


a b

  w(s, t ) f ( x + s, y + t )
g ( x, y) = s = − at = − b
a b

  w(s, t )
s = − at = − b

summation of all coefficient of the mask

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 44
19ECS352: IMAGE PROCESSING

Example

a). original image 500x500 pixel


b). - f). results of smoothing with square averaging
filter masks of size n = 3, 5, 9, 15 and 35,
respectively.
Note:
big mask is used to eliminate small objects from an image.
the size of the mask establishes the relative size of the objects that will be

blended with the background .

a b
c d
e f

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 45
19ECS352: IMAGE PROCESSING

Example

result after smoothing result of thresholding


original image with 15x15 averaging
mask

we can see that the result after smoothing and thresholding, the remains are the largest
and brightest objects in the image.

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 46
19ECS352: IMAGE PROCESSING

Order-Statistics Filters (Nonlinear Filters)

the response is based on ordering (ranking) the pixels contained in the image area
encompassed by the filter
example
median filter : R = median{zk |k = 1,2,…,n x n}
max filter : R = max{zk |k = 1,2,…,n x n}
min filter : R = min{zk |k = 1,2,…,n x n}
note: n x nis the size of the mask

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 47
19ECS352: IMAGE PROCESSING

Median Filters

replaces the value of a pixel by the median of the gray levels in the
neighborhood of that pixel (the original value of the pixel is included in the
computation of the median)

quite popular because for certain types of random noise (impulse noise 
salt and pepper noise) , they provide excellent noise-reduction capabilities,
with considering less blurring than linear smoothing filters of similar size.

forces the points with distinct gray levels to be more like their neighbors.
isolated clusters of pixels that are light or dark with respect to their
neighbors, and whose area is less than n2/2 (one-half the filter area), are
eliminated by an n x n median filter.
eliminated = forced to have the value equal the median intensity of the
neighbors.
larger clusters are affected considerably less

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 48
19ECS352: IMAGE PROCESSING

Example : Median Filters

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 49
19ECS352: IMAGE PROCESSING

Sharpening Spatial Filters

to highlight fine detail in an image or to enhance detail that has been blurred,
either in error or as a natural effect of a particular method of image
acquisition.

Blurring vs. Sharpening


as we know that blurring can be done in spatial domain by pixel averaging
in a neighbors since averaging is analogous to integration thus, we can
guess that the sharpening must be accomplished by spatial differentiation.

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 50
19ECS352: IMAGE PROCESSING

Derivative operator

the strength of the response of a derivative operator is proportional to the


degree of discontinuity of the image at the point at which the operator is
applied.
thus, image differentiation enhances edges and other discontinuities (noise)
deemphasizes area with slowly varying gray-level values.

First-order derivative

a basic definition of the first-order derivative of a one-dimensional function f(x) is

the difference

f
= f ( x + 1) − f ( x)
x

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 51
19ECS352: IMAGE PROCESSING

Second-order derivative

similarly, we define the second-order derivative of a one-dimensional function f(x) is


the difference

First and Second-order derivative of f(x,y)

• when we consider an image function of two variables, f(x,y), at which time we will
dealing with partial derivatives along the two spatial axes.

f ( x, y) f ( x, y) f ( x, y)
Gradient operator f = = +
xy x y

Laplacian operator  2 f ( x, y)  2 f ( x, y)
2 f = +
x 2 y 2
(linear operator)

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 52
19ECS352: IMAGE PROCESSING

Discrete Form of Laplacian


2 f
from = f ( x + 1, y ) + f ( x − 1, y ) − 2 f ( x, y )
x 2
2 f
= f ( x, y + 1) + f ( x, y − 1) − 2 f ( x, y )
y 2

yield,
 2
f = [ f ( x + 1, y) + f ( x − 1, y)
+ f ( x, y + 1) + f ( x, y − 1) − 4 f ( x, y)]

Result Laplacian mask

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 53
19ECS352: IMAGE PROCESSING

Laplacian mask implemented an extension of diagonal neighbors

Other implementation of Laplacian masks

give the same result, but we have to keep in mind


that when combining (add / subtract) a
Laplacian-filtered image with another image.

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 54
19ECS352: IMAGE PROCESSING

Effect of Laplacian Operator

as it is a derivative operator,
it highlights gray-level discontinuities in an image
it deemphasizes regions with slowly varying gray levels
tends to produce images that have
grayish edge lines and other discontinuities, all superimposed on a dark,
featureless background.

Correct the effect of featureless background


easily by adding the original and Laplacian image.
be careful with the Laplacian filter used
 f ( x, y) − 2 f ( x, y)
if the center coefficient of the
g ( x, y) =  Laplacian mask is negative
 f ( x, y) +  f ( x, y)
2

if the center coefficient of the


Laplacian mask is positive

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 55
19ECS352: IMAGE PROCESSING

Example

1 1 1
1 -8 1
1 1 1

a). image of the North pole of the moon


b). Laplacian-filtered image with
c). Laplacian image scaled for display purposes
d). image enhanced by addition with original image

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 56
19ECS352: IMAGE PROCESSING

Mask of Laplacian + addition

•to simply the computation, we can create a mask which do both operations,
Laplacian Filter and Addition the original image.

g ( x, y) = f ( x, y) − [ f ( x + 1, y) + f ( x − 1, y)
0 -1 0
+ f ( x, y + 1) + f ( x, y − 1) + 4 f ( x, y)] -1 5 -1
= 5 f ( x, y) − [ f ( x + 1, y) + f ( x − 1, y)
+ f ( x, y + 1) + f ( x, y − 1)] 0 -1 0

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 57
19ECS352: IMAGE PROCESSING

Example

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 58
19ECS352: IMAGE PROCESSING

Note

 f ( x, y) − 2 f ( x, y)
g ( x, y) = 
 f ( x, y) +  f ( x, y)
2

0 -1 0 0 0 0 0 -1 0
-1 5 -1 = 0 1 0 + -1 4 -1
0 -1 0 0 0 0 0 -1 0

0 -1 0 0 0 0 0 -1 0
-1 9 -1 = 0 1 0 + -1 8 -1
0 -1 0 0 0 0 0 -1 0

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 59
19ECS352: IMAGE PROCESSING

Unsharp masking

f s ( x, y) = f ( x, y) − f ( x, y)
sharpened image = original image – blurred image

•to subtract a blurred version of an image produces sharpening output image.

High-boost filtering
f hb ( x, y) = Af ( x, y) − f ( x, y)

f hb ( x, y) = ( A −1) f ( x, y) + f ( x, y) − f ( x, y)
= ( A − 1) f ( x, y) + f s ( x, y)

generalized form of Unsharp masking A  1

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 60
19ECS352: IMAGE PROCESSING

f hb ( x, y) = ( A − 1) f ( x, y) + f s ( x, y)

• if we use Laplacian filter to create sharpen image fs(x,y) with addition of original
image

 f ( x, y) − 2 f ( x, y)
f s ( x, y) = 
 f ( x, y ) +  2
f ( x, y)
High-boost Masks

• A1
• if A = 1, it becomes “standard”
Laplacian sharpening
Department of Computer Science & Engineering
Dr. Justin Varghese Slide 61
19ECS352: IMAGE PROCESSING

Example

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 62
19ECS352: IMAGE PROCESSING

Fourier Series and Fourier Transform


• Any function that periodically repeats itself can be
expressed as the sum of sines and/or cosines of
different frequencies, each multiplied by a
different coefficient (Fourier series).
• Even functions that are not periodic (but whose
area under the curve is finite) can be expressed as
the integral of sines and/or cosines multiplied by a
weighting function (Fourier transform).

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 63
19ECS352: IMAGE PROCESSING

Background

• The frequency domain


refers to the plane of the two
dimensional discrete Fourier
transform of an image.
• The purpose of the Fourier
transform is to represent a
signal as a linear combination
of sinusoidal signals of
various frequencies.

Department of Computer Science & Engineering


Slide
Slide6464
19ECS352: IMAGE PROCESSING Dr. Justin Varghese
Dr. Justin Varghese

Introduction to the Fourier Transform


and the Frequency Domain

• The one-dimensional Fourier transform and its inverse


– Fourier transform (continuous case)

F (u) =  f ( x)e− j 2ux dx where j = −1
−
– Inverse Fourier transform: e j = cos + j sin

f ( x) =  F (u)e j 2ux du
−
• The two-dimensional Fourier transform and its inverse
– Fourier transform (continuous case)
 
F (u, v) =   f ( x, y)e− j 2 (ux+vy ) dxdy
− −
– Inverse Fourier transform:
 
f ( x, y) =   F (u, v)e j 2 (ux+vy ) dudv
− −

Department of Computer Science & Engineering


Slide
Slide6565
19ECS352: IMAGE PROCESSING Dr. Justin Varghese
Dr. Justin Varghese

Introduction to the Fourier Transform


and the Frequency Domain
• The one-dimensional Fourier transform and its inverse
– Fourier transform (discrete case) DTC
M −1
1
F (u) =
M
 f ( x)e
x =0
− j 2ux / M
for u = 0,1,2,...,M −1

– Inverse Fourier transform:


M −1
f ( x) =  F (u)e j 2ux / M for x = 0,1,2,...,M −1
u =0

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 66
19ECS352: IMAGE PROCESSING

The One-Dimensional Fourier Transform


Example

Department of Computer Science & Engineering


Slide
Slide6767
19ECS352: IMAGE PROCESSING Dr. Justin Varghese
Dr. Justin Varghese

Introduction to the Fourier Transform


and the Frequency Domain
• The two-dimensional Fourier transform and its inverse
– Fourier transform (discrete case) DTC

1 M −1 N −1
F (u, v) = 
MN x=0 y =0
f ( x, y )e − j 2 ( ux / M + vy / N )

for u = 0,1,2,...,M − 1, v = 0,1,2,...,N − 1


– Inverse Fourier transform:

M −1 N −1
f ( x, y) =  F (u, v)e j 2 (ux / M +vy / N )
u =0 v =0

for x = 0,1,2,...,M − 1, y = 0,1,2,...,N − 1


• u, v : the transform or frequency variables
• x, y : the spatial or image variables
Department of Computer Science & Engineering
Slide
Slide6868
19ECS352: IMAGE PROCESSING Dr. Justin Varghese
Dr. Justin Varghese

Introduction to the Fourier Transform


and the Frequency Domain
• We define the Fourier spectrum, phase anble, and power
spectrum as follows:

 
1
F (u, v) = R (u, v) + I (u, v)
2 2 2 ( spectrum)
 I (u, v) 
 (u, v) = tan−1   (phase angle)
 R(u, v) 
P(u,v) = F (u, v) = R 2 (u, v) + I 2 (u, v) (powerspectrum)
2

– R(u,v): the real part of F(u,v)


– I(u,v): the imaginary part of F(u,v)

Department of Computer Science & Engineering


Slide
Slide6969
19ECS352: IMAGE PROCESSING Dr. Justin Varghese
Dr. Justin Varghese

Introduction to the Fourier Transform


and the Frequency Domain
• Some properties of Fourier transform:

 
 f ( x, y)(−1) x + y = F (u −
M
2
N
, v − ) (shift)
2
1 M −1 N −1
F (0,0) = 
MN x =0 y =0
f ( x, y) (average)

F (u, v) = F * (−u,−v) (conujgatesymmetric)


F (u, v) = F (−u,−v) (symmetric)

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 70
19ECS352: IMAGE PROCESSING

The Two-Dimensional DFT and Its Inverse

The 2D DFT F(u,v) can be obtained by


1. taking the 1D DFT of every row of image f(x,y), F(u,y),
2. taking the 1D DFT of every column of F(u,y)

(a)f(x,y) (b)F(u,y) (c)F(u,v)

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 71
19ECS352: IMAGE PROCESSING

The Two-Dimensional DFT and Its Inverse

shift
Department of Computer Science & Engineering
Dr. Justin Varghese Slide 72
19ECS352: IMAGE PROCESSING

The Two-Dimensional DFT and Its Inverse

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 73
19ECS352: IMAGE PROCESSING

The Property of Two-Dimensional DFT


Rotation

DFT

DFT

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 74
19ECS352: IMAGE PROCESSING

The Property of Two-Dimensional DFT


Linear Combination

A
DFT

B
DFT

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 75
19ECS352: IMAGE PROCESSING

The Property of Two-Dimensional DFT


Expansion

A
DFT

B DFT

Expanding the original image by a factor of n (n=2), filling


the empty new values with zeros, results in the same DFT.
Department of Computer Science & Engineering
Dr. Justin Varghese Slide 76
19ECS352: IMAGE PROCESSING

Two-Dimensional DFT with Different Functions

Sine wave Its DFT

Rectangle
Its DFT

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 77
19ECS352: IMAGE PROCESSING

Filtering in the Frequency Domain

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 78
19ECS352: IMAGE PROCESSING

• A fast Fourier transform (FFT) algorithm computes the


discrete Fourier transform (DFT) of a sequence, or its
inverse (IDFT). Fourier analysis converts a signal from its
original domain (often time or space) to a representation in
the frequency domain and vice versa.
• An FFT rapidly computes such transformations than DFT.
• It reduces the complexity of computing the DFT from
O(n^2), which arises if one simply applies the definition of
DFT, to O(n log n), where n is the data size.
• The basic ideas of FFT were popularized in 1965, but some
algorithms had been derived as early as 1805.

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 79
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 80
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 81
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 82
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 83
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 84
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 85
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 86
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 87
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 88
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 89
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 90
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 91
19ECS352: IMAGE PROCESSING

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 92
19ECS352: IMAGE PROCESSING

Questions?

Department of Computer Science & Engineering


Dr. Justin Varghese Slide 93
19ECS352: IMAGE PROCESSING

Thank You

Department of Computer Science & Engineering

You might also like