EECS490: Digital Image Processing Lecture #7 • Image Processing Example • Fuzzy logic – Basics – Image processing examples • Fourier Transform – Inner product, basis functions – Fourier series
EECS490: Digital Image Processing
Lecture #7
• Image Processing Example
• Fuzzy logic
– Basics
– Image processing examples
• Fourier Transform
– Inner product, basis functions
– Fourier series
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Image Processing Example
Laplacian of image
(c) Sharpened byadding Laplacian
Sobel gradientimage
original image
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Image Processing Example
(e) Blurred Sobelgradient image Mask = (c) x (e)
Add Mask to original Power Law IntensityTransform
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Basic Fuzzy Logic
“crisp” membershipfunction
“fuzzy” membershipfunction
Probability: there is a 50% chance that a particular person is youngFuzzy logic: a person’s membership with the set of young people is 0.5
Basically everyone is “young” to some degree. A membership functionrepresents that degree.
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Basic Fuzzy Logic
=max[ A(z), B(z)] =min[ A(z), B(z)]
OR AND
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Basic Fuzzy Logic
Commonly used membership functionsused to describe inputs and outputs.
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Fuzzy Input Variables
We will use asingle colorto describe afruit with acolor thatchangesfrom greento yellow tored as itripens.
A particular color zo has amembership value green(zo),
yellow(zo), and red(zo) in all threeinput membership functions.
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Fuzzy Output Variables
The fruit can beverdant(unfit toeat), half-mature(ripening), andmature (ripe) The output variable is
maturity which is hard toquantify
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Fuzzy System
We nowneed torelate theinputmembershipfunctions tothe outputmembershipfunctions —this iscalledimplication
input membership output membership
This is a simple plot ofthe relationshipbetween the twomembership functions
This is simply themembership function for redAND mature or red mature
red ature(z,v)=min[ red(z), mature(v)]
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
A fuzzy output for a given input
We nowneed toevaluateeach outputmembershipfunction forthe giveninput value
Q3(v)= red(zo) AND red ature(zo,v)=min[[ red(zo), red ature(zo,v)]
red(zo) is a constant c which clips the outputmembership function as shown above
Q3 is still a membership function!
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
All fuzzy outputs for a given input
There are 3 differentinput membershipfunctions each ofwhich can be ANDedwith mature.
This gives threedifferent outputmembership functions.
The system output isthe maximum value ateach point orQ=Q1 OR Q2 OR Q3.
This is the maturemembership functionfor a specific color zo
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Defuzzification
The output is still aset. The actualmembership value isthe center of gravityof the output set.
v0 =vQ v( )
v=1
K
Q v( )v=1
K
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
IF a pixel is dark THEN make it darkerIF a pixel is gray THEN make it grayIF a pixel is bright THEN make itbrighter
The output memberships are only threevalues.
Fuzzy Contrast Enhancement
EECS490: Digital Image Processing
1. Compute the input membershipfunction AND the output membershipfunction
2. For a specific value of input graylevel we map onto a single output plane.The membership is 1 for deep blacksand gradually decreases to zero. Dothis for each output.
Contrast Enhancement
3. Determine the total membershipfunction and compute the centerof gravity of the output
v0 =μdark z0( ) vdark + μgray z0( ) vgray + μbright z0( ) vbright
μdark z0( ) + μgray z0( ) + μbright z0( )
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Original histogram Equalized histogram
Fuzzy membershipfunctions
Fuzzy contrastenhanced histogram
Fuzzy Contrast Enhancement
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Fuzzy Boundary Extraction
IF a pixel belongs to a uniform region THEN make it white ELSE make it black
IF d2 is zero AND d6 is zero THEN z5 is whiteIF d6 is zero AND d8 is zero THEN z5 is whiteIF d8 is zero AND d4 is zero THEN z5 is whiteIF d4 is zero AND d2 is zero THEN z5 is white ELSE z5 is black
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Fuzzy Boundary Extraction Rules
EECS490: Digital Image Processing
© 2002 R. C. Gonzalez & R. E. Woods
Fuzzy Boundary Extraction
Input membership functionfor ZERO intensitydifferences
Output membership function for blackand white
EECS490: Digital Image Processing
Fuzzy System
input membership output membership
This is a plot of therelationship betweenthe two membershipfunctions
This is the membershipfunction for difference ANDwhite
EECS490: Digital Image Processing
A fuzzy output for a given input
We nowneed toevaluateeach outputmembershipfunction forthe giveninput value
This would be the output membership for aspecific intensity difference input ANDwhite
EECS490: Digital Image Processing
The terms shown (blue)
sum to the rippling
square wave (black).
As the number of terms
in the sum becomes large,
it approaches a square
wave (red).
( ) ( )++
==
tnn
tn
122
sin12
1sqOdd-order harmonics
Fact: Any Real Signal has a Frequency-Domain Representation
1999-2007 by Richard Alan Peters II
EECS490: Digital Image Processing
( ) ( )++
==
tnn
tn
122
sin12
1sq
The sinusoids are called
“basis functions”.
Any periodic signal can be described by a sum of sinusoids.
The multipliers are called
“Fourier coefficients”.
Frequency-Domain Representation
1999-2007 by Richard Alan Peters II
EECS490: Digital Image Processing
( ) ( )++
==
tnn
tn
122
sin12
1sq
The sinusoids are called
“basis functions”.
Any periodic signal can be described by a sum of sinusoids.
The multipliers are called
“Fourier coefficients”.
Basisfunctions
Frequency-Domain Representation
1999-2007 by Richard Alan Peters II
EECS490: Digital Image Processing
( ) ( )++
==
tnn
tn
122
sin12
1sq
The sinusoids are called
“basis functions”.
Any periodic signal can be described by a sum of sinusoids.
The multipliers are called
“Fourier coefficients”.
The Fouriercoefficients(of a squarewave).
Frequency-Domain Representation
1999-2007 by Richard Alan Peters II
EECS490: Digital Image Processing
The similarity between functions f and g on the interval - / 2, / 2( )
can be defined by
f , g = f t( ) g* t( )/2
/2
dt
where g* t( ) is the complex conjugate of g t( ).
. onto of projection theasor in ofamount theas ofthought
be also can , and thecalled number, This
gffg
gf of product inner
common. in nothing have
and then0, , if handother theOn . if maximal
isproduct inner their thenenergy, same thehave and If
gfgfgf
gf
==
The Inner Product: a Measure ofSimilarity
1999-2007 by Richard Alan Peters II
EECS490: Digital Image Processing
f , g = f t( ) cos 2 t( ) j sin 2 t( )/2
/2
dt
= f t( )ej2
t
/2
/2
dt
= f t( )e j t
/2
/2
dt
( ) ( )dtttfgf =
2/
2/
2sin, ( ) ( )dtttfgf =
2/
2/
2cos,
ej2
t= cos 2 t( ) j sin 2 t( )
=2
3 differentrepresentations
Inner Product of a Periodic Function and aSinusoid
1999-2007 by Richard Alan Peters II
EECS490: Digital Image Processing
( ) ( )dtttfgf =
2/
2/
2sin,
( ) ( ) ( )[ ]
( )
( ) dtetf
dtetf
dttittfgf
ti
ti
=
=
=
2/
2/
2/
2/
2
2/
2/
22sincos,
( ) ( )dtttfgf =
2/
2/
2cos,
real number resultsyield the amplitudeof that sinusoid inthe function.
Inner Product of a Periodic Function and aSinusoid
1999-2007 by Richard Alan Peters II
EECS490: Digital Image Processing
( ) ( )dtttfgf =
2/
2/
2sin,
( ) ( ) ( )[ ]
( )
( ) dtetf
dtetf
dttittfgf
ti
ti
=
=
=
2/
2/
2/
2/
2
2/
2/
22sincos,
( ) ( )dtttfgf =
2/
2/
2cos,
Complex number resultyields the amplitude andphase of that sinusoid inthe function.
Inner Product of a Periodic Function and aSinusoid
1999-2007 by Richard Alan Peters II
EECS490: Digital Image Processing
is the decomposition of a -periodic signal into a sum of sinusoids.
( )=
++=1
0
2sin
2cos
n
nn tn
Btn
AAtf
( )
( ) 02
sin2
02
cos2
2/
2/
2/
2/
=
=
ndttn
tfB
ndttn
tfA
nn
nn
for
for
Fourier coefficients aregenerated by taking theinner product of thefunction with the basis.
The representation of afunction by its FourierSeries is the sum of sinu-soidal “basis functions”multiplied by coefficients.).()(: tfntf =± that such periodic
The Fourier Series
1999-2007 by Richard Alan Peters II
EECS490: Digital Image Processing
can also be written in terms of complex exponentials
f t( ) = Cn
n=
e+ j 2 n t
= Cn
n=
e+ j 2 n t + n
= Cn cos2 n
t + n + j Cn sin2 n
t + n
n=
Cn = Cn e+ j n =1
f t( ) ej 2 n t
/2
/2
dt
=1
f t( ) cos2 n
t n j sin2 n
t n
/2
/2
dt
j = 1
n
tfntf
intergers all for
)()( =+
Cn = Cn e + j n
e ± j x= cos x ± j sin x
The Fourier Series
1999-2007 by Richard Alan Peters II
EECS490: Digital Image Processing
f (t) = Cn
n=
e+ j 2 n t
where Cn = Cn e+ j n .
Cn represents the
amplitude, A=|Cn|,
and relative phase, ,
of that part of the
original signal, f (t),
that is a sinusoid of
frequency n = n / .
0
Why are Fourier Coefficients ComplexNumbers?
1999-2007 by Richard Alan Peters II