Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
1
Digital Image Processing
Fuzzy Techniques for Intensity Transformations and Spatial Filtering
Christophoros Niko
University of Ioannina - Department of Computer Science
Christophoros [email protected]
2 Contents
In this lecture we will look at spatial filtering techniques:q
– General principles of fuzzy set theory– Intensity transformations using fuzzy sets– Spatial filtering using fuzzy sets
C. Nikou – Digital Image Processing (E12)
2
3 Introduction
• Fuzzy sets provide a framework to incorporate human logic in problems with imprecise concepts.
• Set membership– Crisp sets: the membership function assigns
values of 0 or 1 (the element belongs to the set or not).
C. Nikou – Digital Image Processing (E12)
– Fuzzy sets: the membership function has a gradual transition between 0 and 1 (the element has a degree of membership).
4 Introduction (cont.)
• Example: let Z be the set of all people and we want to define a subset A, the set of young people.
C. Nikou – Digital Image Processing (E12)
Crisp set Fuzzy set
• We may make statements as: young, relatively young, not so young...
• It is not a probability!
3
5 Principles of fuzzy set theory
• Let Z= {z} be a set of elements with a generic element denoted by z.
• A fuzzy set A in Z is characterized by a membership function μA(z) that associates to each element of z a real number in [0,1], the grade of membership.
• A fuzzy set is an ordered pair
C. Nikou – Digital Image Processing (E12)
y p
{ }, ( ) |A z z z ZμΑ= ∈
6 Principles of fuzzy set theory (cont.)
• Empty fuzzy set: ( ) 0,A z z Zμ = ∀ ∈
• Equality:
• Complement (NOT):
• Subset:
( ) 1 ( )AA z zμ μ= −
if andonly if ( ) ( ),A BA B z z z Zμ μ= = ∀ ∈
if and onlyif ( ) ( ),A BA B z z z Zμ μ⊂ ≤ ∀ ∈
C. Nikou – Digital Image Processing (E12)
• Union (OR):
• Intersection (AND):
A B
[ ]: ( ) max ( ), ( )U A BU A B z z zμ μ μ= ∪ =
[ ]: ( ) min ( ), ( )I A BI A B z z zμ μ μ= ∩ =
4
7 Principles of fuzzy set theory (cont.)
C. Nikou – Digital Image Processing (E12)
8 Common membership functions
C. Nikou – Digital Image Processing (E12)
5
9 Using fuzzy sets
• Example: Use colour to categorize fruit into three groups: verdant, half-mature and mature. Ob i i f i l d• Observations at various stages of maturity led to the conclusions:
– A verdant fruit is green– A half mature fruit is yellow– A mature fruit is red.
• The colour is a vague description and has to be
C. Nikou – Digital Image Processing (E12)
The colour is a vague description and has to be expressed in fuzzy format.
– Linguistic variable (colour) with a linguistic value (e.g. red) is fuzzified through the membership function.
10 Using fuzzy sets (cont.)
C. Nikou – Digital Image Processing (E12)
6
11 Using fuzzy sets (cont.)
• The problem specific knowledge may be formalized in the form of fuzzy IF-THEN rules:
– R1: IF the color is green, THEN the fruit is verdant.
OR– R2: IF the color is yellow, THEN the fruit is half-
t
C. Nikou – Digital Image Processing (E12)
mature.OR
– R3: IF the color is red, THEN the fruit is mature.
12 Using fuzzy sets (cont.)
• The next step is to perform inference or implication, that is, to use the inputs and the knowledge (IF THEN rules) to obtain the outputknowledge (IF-THEN rules) to obtain the output.
• As the input is fuzzy, the output (maturity) is, in general, also fuzzy.
C. Nikou – Digital Image Processing (E12)
7
13 Using fuzzy sets (cont.)
• For the sake of clarity, let’s see it through R3:– IF the color is red, THEN the fruit is mature.
• Red AND mature is the intersection (AND) of the membership functions μred (z) and μmat (v).
• Notice that the independent variables are different (z and v) and the result will be two-dimensional (2D).
• The intersection corresponds to the minimum:
C. Nikou – Digital Image Processing (E12)
The intersection corresponds to the minimum:
{ }3( , ) min ( ), ( )red matz v z vμ μ μ=
14 Using fuzzy sets (cont.)
C. Nikou – Digital Image Processing (E12)
{ }3( , ) min ( ), ( )red matz v z vμ μ μ=
8
15 Using fuzzy sets (cont.)
• In general, we are interested in a specific input (e.g. a value of red z0).T fi d h i bl f h AND• To find the output variable, we perform the AND operation between μred (z0)=c and the general 2D result μ3(z,v):
{ }3 0 3 0( ) min ( ), ( , )redQ v z z vμ μ=
C. Nikou – Digital Image Processing (E12)
16 Using fuzzy sets (cont.)
• Equivalently, for the other rules:{ }2 0 2 0( ) min ( ), ( , )yellowQ v z z vμ μ= { }2 0 2 0yellow
{ }1 0 1 0( ) min ( ), ( , )greenQ v z z vμ μ=
• The complete fuzzy output is given by:
1 2 3OR ORQ Q Q Q=
which is the union (OR) of the three individual fuzzy
C. Nikou – Digital Image Processing (E12)
which is the union (OR) of the three individual fuzzy sets. Because OR is defined as the max operator:
{ }{ }0 0( ) max min ( ), ( , )s rsrQ v z z vμ μ=
{1,2,3}, { , , }r s green yellow red= =
9
17 Using fuzzy sets (cont.)
• Input of the membership functions to colour z0.0
• Individual output for each rule
– the clipped cross-sections discussed previously
C. Nikou – Digital Image Processing (E12)
d scussed p e ous y
• Union of the outputs
18 Using fuzzy sets (cont.)
• We have the complete output corresponding to a specific input (colour z0).p p ( 0)
• To obtain a crisp value for the maturity of that colour (defuzzification), one way is to compute the center of gravity:
1( )K
vvQ v
=∑
C. Nikou – Digital Image Processing (E12)
10
1( )
vK
v
vQ v
=
= ∑∑
10
19 Using fuzzy sets (cont.)
• We may combine more than one inputs.
C. Nikou – Digital Image Processing (E12)
20Contrast enhancement using fuzzy
sets• The problem may be stated using the following
rules:– IF a pixel is dark, THEN make it darker– IF a pixel is gray, THEN make it gray– IF a pixel is bright, THEN make it brighter
• Both input and output are fuzzy terms
C. Nikou – Digital Image Processing (E12)
11
21Contrast enhancement using fuzzy
sets (cont.)• We are dealing with constants in the output in this
example, membership and the expression is p , p psimplified:
0 0 00
0 0 0
( ) ( ) ( )( ) ( ) ( )
dark d gray g bright b
dark gray bright
z v z v z vv
z z zμ μ μ
μ μ μ× + × + ×
=+ +
C. Nikou – Digital Image Processing (E12)
22Contrast enhancement using fuzzy
sets (cont.)• Notice the difference in the hair and forehead with
respect to histogram equalization.p g q
C. Nikou – Digital Image Processing (E12)
12
23Contrast enhancement using fuzzy
sets (cont.)• The histogram expanded but its main characteristics were
kept contrary to histogram equalization.
C. Nikou – Digital Image Processing (E12)
24 Spatial filtering using fuzzy sets
• A boundary extraction algorithm may have the rulesthe rules
– If a pixel belongs to a uniform region, then make it white
– Else make it black• Uniform region, black and white are fuzzy
sets and we have to define their their
C. Nikou – Digital Image Processing (E12)
sets and we have to define their their membership functions
13
25 Spatial filtering using fuzzy sets
• A simple set of rules:– IF d2 is zero AND d6 is zero THEN z5=white– IF d6 is zero AND d8 is zero THEN z5=white– IF d8 is zero AND d4 is zero THEN z5=white– IF d4 is zero AND d2 is zero THEN z5=white– ELSE z5=black
C. Nikou – Digital Image Processing (E12)
26 Spatial filtering using fuzzy sets
• Membership functions (for input: zero, output: black and white) and fuzzy rules
C. Nikou – Digital Image Processing (E12)
14
27 Spatial filtering using fuzzy sets
• Membership functions (for input: zero, output: black and white) and fuzzy rules
C. Nikou – Digital Image Processing (E12)