0% found this document useful (0 votes)
6 views131 pages

Module 4-1

This document discusses the fundamentals of frequency domain filtering, including the process of modifying the Fourier Transform (FT) of an image and applying filters to achieve desired outputs. It outlines the steps for filtering, the types of filters (ideal, Butterworth, Gaussian), and the importance of zero padding to avoid errors during processing. Additionally, it covers advanced topics like high-pass filtering, Laplacian filtering, and homomorphic filtering for image enhancement.

Uploaded by

siriramesh83
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)
6 views131 pages

Module 4-1

This document discusses the fundamentals of frequency domain filtering, including the process of modifying the Fourier Transform (FT) of an image and applying filters to achieve desired outputs. It outlines the steps for filtering, the types of filters (ideal, Butterworth, Gaussian), and the importance of zero padding to avoid errors during processing. Additionally, it covers advanced topics like high-pass filtering, Laplacian filtering, and homomorphic filtering for image enhancement.

Uploaded by

siriramesh83
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/ 131

Module 4

Frequency Domain
2 b ck to b ck h lf
periods meeting t
point M/2

x
Multiply f(x) by (−1)

4 qu rter periods meeting


t the point (M/2,N/2)
Multiplyf(x, y) by
x+y
(−1)
a
a
a
a
a
a
The B sics of Filtering in Frequency Dom in
a
a
Frequency dom in iltering fund ment ls
Modifying the FT of n im ge nd then computing IFT to obt in the processed
result.

Given digit l im ge f(x, y) of size M x N, the b sic iltering equ tion is

−1
g(x, y) = [H(u, v)F(u, v)]
−1
Where is the IDFT
The ilter function H
F(u, v) is the DFT of input im ge f(x, y)
modi ies the tr nsform of
the input im ge resulting H(u, v) is ilter tr nsfer function
in processed output g
g(x, y) is the iltered output (im ge)

F, H nd g re m trix of size M x N
𝔉
𝔉
f
a
f
a
a
a
a
a
a
a
a
f
a
f
f
a
a
a
a
a
a
a
f
a
a
a
• One of the simplest ilters we c n construct is ilter H(u, v) th t is 0 t
the center of the tr nsform nd 1 elsewhere.

• This ilter reject dc term nd p ss ll other terms of F(u, v) when we


multiply H(u, v)F(u, v)
f
a
f
a
a
a
a
a
a
f
a
a
DC component is responsible for ver ge intensity of n im ge, setting it to
zero will reduce the ver ge intensity of n im ge.
a
a
a
a
a
a
a
a
LPF nd HPF in frequency dom in
a
a
Zero p dding nd wr p round error
a
a
a
a
wr p round error exist in n im ge fter iltering, if we do not p d
su icient number of zeros to input im ge.
ff
a
a
a
a
a
a
f
a
How do we h ndle zero p dding on ilter H which is in frequency dom in?

Results in ringing e ect


which distort the
processed( iltered) im ge
f
a
ff
a
a
f
a
P dding zeros to H in sp ti l dom in results in ringing e ect which distort
the processed( iltered) im ge
a
f
a
a
a
a
ff
One ppro ch to this problem is -

Zero p d im ges nd then cre te ilters in the frequency dom in to be of


the s me size s the p dded im ges.
a
a
a
a
a
a
a
a
a
a
f
a
Result of ch nging ph se ngle in iltered im ge.

Bec use the DFT is complex rr y, we c n express it in terms of its re l


nd im gin ry p rts

F(u, v) = R(u, v) + jI(u, v)


−1
g(x, y) = [H(u, v)R(u, v) + jH(u, v)I(u, v)]
Even sm ll ch nges in ph se ngle c n h ve dr m tic e ects on iltered
output.
𝔉
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
f
a
a
a
a
a
a
ff
f
a
B sic sh pe rem in unch nged but intensity distribution is quite distorted
a
a
a
a
Summ ry of steps for iltering in the Frequency dom in

1. Given n input im ge f(x, y) of size M x N, obt in the p dding p r meters P nd Q. (Typic lly
P = 2M nd Q = 2N )

2. Form p dded im ge, fp(x, y) of size P x Q by ppending the necess ry number of zeros to f(x, y)

x+y
3. Multiply fp(x, y) by (−1) to center its tr nsform

4. Compute the DFT, F(u, v), of the im ge in step 3.

5. Gener te ilter function H(u, v) of size P x Q

−1 x+y
6. Obt in the processed im ge : gp(x, y) = {real[ [G(u, v)]]}(−1)

7. Obt in in l processed im ge g(x, y) by extr cting M x N region of gp(x, y)


𝔉
a
a
a
a
a
a
a
f
a
a
f
a
a
a
a
f
a
a
a
a
a
a
a
a
a
a
a
a
a
Block di gr m of import nt steps involved in frequency dom in ilter
a
a
a
f
• `
Correspondence between iltering in sp ti l nd frequency dom in

Fourier tr nsform p ir:


a
a
f
a
a
a
a
Import nce of this two p ir of equ tions re

• G ussi n nd re l, moreover, g ussi n curve re intuitive nd e sy to


m nipul te

• The function beh ves reciproc lly

The key similarity between the


two lters is that all their values
are positive. Thus, we conclude
that we can implement lowpass
ltering in the spatial domain by
using a mask with all positive
coef cients
fi
a
a
fi
fi
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
More complex lters can be constructed using the basic Gaussian function

fi
Im ge smoothing using Frequency dom in ilters

Three types of lowp ss ilter-

1. Ide l

2. Butterworth

3. G ussi n

Butterworth ilter h s p r meter c lled s ilter order.

For higher order - cts s ide l ilter

For lower order - more like g ussi n ilter.


a
a
a
a
f
a
a
a
a
a
f
a
a
a
a
a
f
a
a
f
a
a
f
f
1. Ide l lowp ss Filter

A 2D lowp ss ilter th t p sses ll frequencies within circle of r dius D0


from the origin nd cuts o ll frequencies outside this circle is c lled n
ide l lowp ss ilter (ILPF)

Where D0 is positive const nt nd D(u, v) is the dist nce between point


(u, v) in the frequency dom in nd the center of the frequency rect ngle

Where, P nd Q re p dded sizes.


a
a
a
a
a
a
a
f
f
a
a
a
a
a
ff
a
a
a
a
a
a
a
a
a
a
a
a
a
The point of tr nsition between H(u, v) = 1 nd H(u, v) = 0 is c lled the cuto
frequency.
a
a
a
ff
Setting cuto frequency

• One w y to est blish set of st nd rd cuto frequency is to compute


circles th t enclose speci ied mounts of tot l im ge power PT.
a
a
ff
a
a
f
a
a
a
ff
a
a
This qu ntity is obt ined by summing the components of the power spectrum of the p dded im ges
t e ch point (u, v), for u = 0,1,...,P − 1 nd v = 0,1,...,Q − 1

Where
a
a
a
a
a
a
a
If the DFT h s been centered, circle of r dius D0 with origin t the center
of the frequency rect ngle encloses α percent of the power, where

Summ tion is t ken over v lues of (u, v) th t lie inside the circle or on
its bound ry
a
a
a
a
a
a
a
a
a
a
Spectrum f lls o
r pidly, with 87 %
of the tot l power
being enclosed by
rel tively sm ll
circle of r dio 10
a
a
a
a
a
a
a
ff
2. Butterworth Lowp ss ilter

The TF of Butterworth ilter (BLPF) of order n, nd with cuto frequency t


dist nce D0 from the origin, is de ined s

Where, D(u, v) is given by


a
a
a
a
f
f
f
a
a
ff
a
3. G ussi n Lowp ss Filters

G ussi n lowp ss ilters (GLPFs) is of the form

Where D(u, v) is the dist nce from center of the frequency rect ngle.

σ is me sure of spre d bout the center

If σ = D0,
a
a
a
a
a
a
a
f
a
a
a
a
a
Im ge sh rpening using Frequency Dom in ilters

A highp ss ilter is obt ined from given lowp ss ilter using the equ tion

Where HLP(u, v) is the tr nsfer function of the lowp ss ilter.


a
a
a
f
a
a
a
a
a
f
f
a
f
a
1. Ide l Highp ss Filters
a
a
2. Butterworth Highp ss Filters

a
2. G ussi n Highp ss Filters
a
a
a
The L pl ci n in Frequency Dom in
The l pl ci n c n be implemented in frequency dom in using the ilter

Rewriting it with respect to center of the frequency rect ngle,

The L pl ci n im ge is obt ined s


a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
f
Processed im ge(Enh ncement) is chieved using the equ tion

Here, c = − 1 bec use H(u, v) is neg tive.


In frequency dom in,
a
a
a
a
a
a
a
Unsh rp M sking, Highboost Filtering, nd High-Frequency-Emph sis Filtering:
a
a
a
a
The expression cont ined within the squ re br ckets is c lled high-frequency- emph sis ilter
a
a
a
a
a
a
f
A slightly more gener l formul tion of high-frequency-emph sis iltering is
the expression

a
a
a
f
The function f(x, y) is ch r cterised by two components:

1. Amount of source illumin tion incident on the scene - illumin tion


component, i(x, y)

2. Amount of illumin tion re lected by the objects in the scene -


re lect nce component, r(x, y)

i.e, f(x, y) = i(x, y)r(x, y)

Where, 0 < i(x, y) < ∞

nd, 0 < r(x, y) < 1


Tot l Tot l
bsorption re lect nce
a
a
f
f
a
a
a
a
a
a
a
a
f
a
Homomorphic Filtering

An im ge f(x, y) c n be expressed s the product of its illumin tion, i(x, y)


nd re lect nce, r(x, y), components:
a
a
f
a
a
a
a
This equ tion c nnot be used directly to oper te on the frequency
components of illumin tion nd re lect nce bec use the Fourier
tr nsform of product is not the product of the tr nsforms:
a
a
a
a
a
a
f
a
a
a
a
However, suppose we de ine

f
Where Fi(u, v) nd Fr(u, v) re the Fourier tr nsform of ln i(x, y) nd
ln r(x, y), respectively

We c n ilter Z(u, v) using ilter H(u, v) so th t

S(u, v) = H(u, v)Z(u, v)

= H(u, v)Fi(u, v) + H(u, v)Fr(u, v)


a
f
a
a
a
f
a
a
a
Fin lly, bec use z(x, y) w s formed by t king the n tur l log rithm of the input
im ge, we reverse the process by t king exponenti l of the iltered result to form
the output im ge:
a
a
a
a
a
a
a
a
a
a
f
a
Adv nt ge of homomorphic ilter

Homomorphic ilters t kes control of g in over the illumin tion nd


re lect nce components.

It tends to ttenu te the contribution m de by the low


frequency(illumin tion) nd mplify the contribution m de by high
frequency(re lect nce).

It results in simult neous dyn mic r nge compression nd contr st


enh ncement.
f
a
a
a
a
f
a
f
a
a
a
a
a
a
f
a
a
a
a
a
a
a
a
a
a
Color Fund ment ls

violet, blue, green, yellow, or nge, nd red.


a
a
a
a
• The colours th t hum ns perceive in n object re determined by the
n ture of the light re lected from the object.

• Green objects re lect light with w velengths prim rily in the 500 to
570nm r nge while bsorbing most of the energy t other w velengths.
a
a
a
f
a
f
a
a
a
a
a
a
a
• Chrom tic light sp ns electrom gnetic spectrum from pproxim tely
400nm to 700nm.

• Three b sic qu ntities re used to describe the qu lity of chrom tic


light source

1. R di nce

2. lumin nce

3. Brightness
a
a
a
a
a
a
a
a
a
a
a
a
a
a
1. R di nce is the tot l mount of energy th t lows from the light source.

— Me sured in w tts (W)


a
a
a
a
a
f
a
a
2. Lumin nce is the mount of energy n observer perceives from
light source.

—Me sured in lumens(lm)


a
a
a
a
a
3. Brightness is subjective descriptor th t is pr ctic lly impossible to
me sure.
a
a
a
a
a
Role of cones in hum n eye

• Cones re the sensors in the eye nd is responsible for color vision.

• Around 6 to 7 million cones in hum n eye re divided into three


princip l sensing c tegories, roughly to red, green nd blue.

— Approxim tely 65% of ll cones re sensitive to red light

— 33% re sensitive to green light

— 2% re sensitive to blue
a
a
a
a
a
a
a
a
a
a
a
a
a
No single color m y be
c lled s red, green or blue.

Experiment l curves det iling the bsorption of light by red, green nd blue
cones in the eye.
a
a
a
a
a
a
a
W velength ssigned to prim ry colours

• Colors re seen s v ri ble combin tions of prim ry colours -


red(R), green(G) nd blue(B).

• CIE (intern tion l commission on illumin tion) h s ssigned speci ic


w velength v lues to three prim ry colours:

Blue = 435.8nm, green = 546.1nm nd red=700nm.


a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
f
Gener ting second ry colours

The prim ry colours c n be dded to produce the second ry colours of


light

M gent (r+b)

cy n (g+b)

Yellow (r+g)
a
a
a
a
a
a
a
a
a
brightness, hue, nd s tur tion

• The ch r cteristics gener lly used to distinguish one color from


nother re brightness, hue, nd s tur tion.

Brightness - chrom tic notion of intensity

Hue - ttribute ssoci ted with domin nt w velength in mixture of light


w ves.

S tur tion - rel tive purity or mount of white light mixed with hue.

• Hue nd s tur tion together c lled s chrom ticity.


a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
• Amount of red, green nd blue needs to form ny p rticul r color re
c lled the tristimulus v lues nd re denoted by X, Y nd Z
respectively.

• A color is then speci ied by its trichrom tic coe icients, de ines s

Also, x+y+z=1
a
f
a
a
a
a
a
a
ff
a
a
a
f
a
a
• Another ppro ch for specifying colours is to use CIE chrom ticity
di gr m (shows color composition s function of x (red) nd y (green)).

• For ny v lue of x nd y, the corresponding z is obt ined using the


formul : z = 1 − (x + y)
a
a
a
a
a
a
a
a
a
a
a
a
a
• Pure colours re indic ted round the
bound ry

• Any point inside the bound ry is some mixture


of spectrum colours.

• The point of equ l energy corresponds to


equ l fr ctions of the three prim ry colours.

• Any point le ves the bound ry nd


ppro ches the point of equ l energy, more
white light is dded to the color nd becomes
less s tur ted.

• S tur tion t the point of equ l energy is zero.

• Useful in color mixing bec use str ight line


joining ny two points de ines ll the di erent
color v ri tions th t c n be obt ined by
combining these two colors dditively.
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
f
a
a
a
a
a
a
a
a
a
a
a
a
a
a
ff
Color Models

1. The RGB Color Model

2. The CMY nd CMYK Color Models

3. The HSI color Model


a
The RGB Color Model

B sed on c rtesi n coordin te system

The color subsp ce of interest is the cube


a
a
a
a
a
• Here, RGB prim ry v lues re t the three corners.

• The second ry colours cy n, m gent nd yellow re t the other


corners.

• Bl ck is t the origin nd white is t the corner f rthest from the origin.


a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
The ssumption is th t ll color v lues h ve been norm lised so th t the
cube is the unit cube. (All v lues of R, G, nd B re ssumed to be in the
r nge [0, 1])
a
a
a
a
a
a
a
a
a
a
a
a
Pixel depth

The number of bits used to represent e ch pixel in RGB sp ce is c lled the


pixel depth.

Consider n RGB im ge in which e ch of the red, green nd blue im ges is


n 8-bit im ge.

Under these conditions e ch RGB color pixel is s id to h ve depth of 24


bits.

The term full-colour im ge is used often to denote 24-bit RGB color im ge.

8 3
The tot l number of colours in 24-bit RGB im ge is (2 ) = 16,777,216.
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
• The di erent colors in this model re points on or inside the cube

• E ch color is de ined by vector extending from the origin.


a
ff
f
a
Subset of colors

• It is of consider ble interest to h ve subset of colors th t re likely to be


reproduced f ithfully independent of di erent h rdw res used.

• This subset of colors is c lled the set of s fe RGB colors (s fe web


colors or s fe browser colors)

• There re like 256 colors which re considered s subset of colors


a
a
a
a
a
a
a
a
ff
a
a
a
a
a
a
a
• Forty of these 256 colors re known to be processed di erently by v rious
oper ting systems, le ving only 216 colors th t re common to most
systems.
a
a
a
a
a
ff
a
• E ch of the 216 s fe colors is formed from three RGB v lues but e ch
3
v lue c n only be - 0, 51, 102, 153, 204 or 255. ——-> (6) = 216
• These v lues represented in hex gon l numbers system.

000000 = Black
FFFFFF = white
FF0000 = pure red and so on…
a
a
a
a
a
a
a
a
a
FFFFFF FFCCFF FF99FF FF66FF FF33FF FF00FF

FFFFCC FFCCCC FF99CC FF66CC FF33CC FF00CC

FFFF99 FFCC99 FF9999 FF6699 FF3399 FF0099

FFFF66 FFCC66 FF9966 FF6666 FF3366 FF0066

FFFF33 FFCC33 FF9933 FF6633 FF3333 FF0033

FFFF00 FFCC00 FF9900 FF6600 FF3300 FF0000

• 216 colors, org nised in descending RGB v lues.


a
a
• Figure shows RGB s fe color cube.

• It h s v lid colors only on the surf ce pl nes

• E ch pl ne h s 36 colors, so the entire surf ce h s 216 colors s


expected.
a
a
a
a
a
a
a
a
a
a
a
The CMY nd CMYK Color Models
• Most devices th t deposit colored pigments on p per, such s color
printers nd copiers, require CMY d t input or perform n RGB to CMY
conversion intern lly.

• Here, ssumption is th t ll color v lues h ve been norm lised to the


r nge [0, 1].
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
• Equ l mounts of pigment prim ries (cy n, m gent nd yellow) should
produce bl ck.

• In pr ctice, combining these colors for printing produces muddy-looking


bl ck.

• In order to produce true bl ck, fourth color, bl ck is dded , giving rise to


the CMYK color model.
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
The HSI Color Model

Why Convert from RGB to HSI?

• RGB is device-oriented (used for screens nd sensors).

• HSI is perception-oriented (closer to how hum ns interpret color).

• Sep r ting intensity from color inform tion (hue nd s tur tion) llows for
better m nipul tion of brightness nd color independently.
a
a
a
a
a
a
a
a
a
a
a
a
Magenta (r+b), cyan(g+b), Yellow (r+g)
Converting colors from RGB to HSI

Given n im ge in RGB color form t, the I component of e ch RGB pixel is


obt ined using the equ tion
a
a
a
a
a
a
Hue (H)

Denomin tor is the norm liz tion f ctor, ensuring th t the ngle
we get from cos inverse is geometric lly v lid
a
a
a
a
a
a
a
a
Converting colors from HSI to RGB

Given v lues HSI in the interv l [0, 1], we now w nt to ind corresponding
RGB v lues in the s me r nge.

It depends on v lues of H nd is divided into three sector of interest

0 0
1. RG sector (0 ≤ H < 120 )
0 0
2. GB sector (120 ≤ H < 240 )
0 0
3.BR sector (240 ≤ H < 360 )
a
a
a
a
a
a
a
a
f
0 0
1. RG sector (0 ≤ H < 120 )
0 0
2. GB sector (120 ≤ H < 240 )
0 0
BR sector (240 ≤ H < 360 )
Pseudocolor Im ge Processing

Pseudocolor ( lso c lled f lse color) im ge processing consists of ssigning


colours to grey v lues b sed on speci ied criterion.

Simplest ex mple of pseudocolor im ge processing is -

1. Intensity slicing

2. Intensity to Color Tr nsform tion


a
a
a
a
a
a
a
a
a
a
a
a
f
a
• Here, im ge is interpreted s 3D function

• Slicing is done by pl cing pl nes p r llel to the coordin te pl ne

• E ch pl ne slices the function in the re of intersection.

• If di erent color is ssigned to e ch side of the pl ne, ny pixel whose


intensity level is bove the pl ne will be coded s one color nd ny
pixel below the pl ne will be coded with other.
a
a
ff
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
Technique used is summ rised s follows -
• Let [0, L − 1] represent the grey sc le

• Let level l0 represent bl ck [ f(x, y) = 0] nd level lL−1 represent white


[ f(x, y) = L − 1]

• P pl nes re de ined t levels l1, l2, . . . , lp

• Assuming th t 0 < P < L − 1, the P pl nes p rtition the grey sc le into P + 1


interv ls, V1, V2, . . . , VP+1.

• Intensity to color ssignments re m de ccording to the rel tion

th
Where ck is the color ssoci ted with the k intensity interv l Vk
de ined by the p rtitioning pl nes.
f
a
a
a
a
f
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
When more levels re used, the m pping function t kes on st irc se form
a
a
a
a
a
a
Intensity to Color Tr nsform tion

• The ide underlying this ppro ch is to perform three independent


tr nsform tions on the intensity of ny input pixel.

• The three results re th n fed sep r tely into the red, green, nd blue
ch nnels of color television monitor.
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
Coding which involves sever l monochrome im ges

• The type of ddition l processes c n be techniques such s color


b l ncing, combining im ges etc..
a
a
a
a
a
a
a
a
a
four spectral satellite images of Washington, D.C., including part of the
Potomac River. The irst three images are in the
visible red, green, and blue, and the fourth is in the near infrared

You might also like