ΠΑΝΕΠΙΣΤΗΜΙΟ ΙΩΑΝΝΙΝΩΝ ΑΝΟΙΚΤΑ ΑΚΑΔΗΜΑΪΚΑ ΜΑΘΗΜΑΤΑ Ψηφιακή Επεξεργασία Εικόνας Μετασχηματισμοί έντασης και χωρικό φιλτράρισμα Διδάσκων : Αναπληρωτής Καθηγητής Νίκου Χριστόφορος Άδειες Χρήσης Το παρόν εκπαιδευτικό υλικό υπόκειται σε άδειες χρήσης Creative Commons. Για εκπαιδευτικό υλικό, όπως εικόνες, που υπόκειται σε άλλου τύπου άδειας χρήσης, η άδεια χρήσης αναφέρεται ρητώς.
Digital Image Processing Fuzzy Techniques for Intensity Transformations and Spatial Filtering Christophoros Nikou cnikou@cs.uoi.gr University of Ioannina - Department of Computer Science 2 Contents In this lecture we will look at spatial filtering techniques: General principles of fuzzy set theory Intensity transformations using fuzzy sets Spatial filtering using fuzzy sets 1
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). 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. Crisp set Fuzzy set We may make statements as: young, relatively young, not so young... It is not a probability! 2
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 {, ( ) } A = z z z Z μ Α 6 Principles of fuzzy set theory (cont.) Empty fuzzy set: μ ( z A ) = 0, z Z Equality: A = B if and onlyif μ ( z) = μ ( z), z Z A B Complement (NOT): μ ( z ) = 1 μ A( z ) A Subset: A B if and onlyif μ ( z) μ ( z), z Z A B Union (OR): U = A B: μ ( z) = max μ ( z), μ ( z) Intersection (AND): [ ] U A B [ ] I = A B: μ ( z) = min μ ( z), μ ( z) I A B 3
7 Principles of fuzzy set theory (cont.) 8 Common membership functions 4
9 Using fuzzy sets Example: Use colour to categorize fruit into three groups: verdant, half-mature and mature. 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 expressed in fuzzy format. Linguistic variable (colour) with a linguistic value (e.g. red) is fuzzified through the membership function. 10 5
11 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- mature. OR R3: IF the color is red, THEN the fruit is mature. 12 The next step is to perform inference or implication, that is, to use the inputs and the knowledge (IF-THEN rules) to obtain the output. As the input is fuzzy, the output (maturity) is, in general, also fuzzy. 6
13 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: 3 { } μ (,) zv = min μ (), z μ () v red mat 14 3 { } μ (,) zv = min μ (), z μ () v red mat 7
15 In general, we are interested in a specific input (e.g. a value of red z 0 ). To find the output variable, we perform the AND operation between μ red (z 0 )=c and the general 2D result μ 3 (z,v): Q () v = min μ ( z ), μ ( z,) v { } 3 red 0 3 0 16 Equivalently, for the other rules: Q 2() v min μ yellow( z 0), μ 2( z 0,) v Q () v = min μ ( z ), μ ( z,) v = { } { green } 1 0 1 0 The complete fuzzy output is given by: Q= Q OR Q OR Q 1 2 3 which is the union (OR) of the three individual fuzzy sets. Because OR is defined as the max operator: { { μs 0 μr 0 }} Qv () = maxmin ( z), ( z,) v r s r = {1, 2, 3}, s = { green, yellow, red} 8
17 Input of the membership functions to colour z 0. 0 Individual output for each rule the clipped cross-sections discussed previously Union of the outputs 18 We have the complete output corresponding to a specific input (colour z 0 0) ). To obtain a crisp value for the maturity of that colour (defuzzification), one way is to compute the center of gravity: v K v = 1 0 = K v = 1 vq() v Qv () 9
19 We may combine more than one inputs. 20 Contrast 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 10
21 Contrast enhancement using fuzzy sets (cont.) We are dealing with constants in the output in this example, membership and the expression is simplified: v 0 μ ( z ) v + μ ( z ) v + μ ( z ) v = μ ( z ) + μ ( z ) + μ ( z ) dark 0 d gray 0 g bright 0 b dark 0 gray 0 bright 0 22 Contrast enhancement using fuzzy sets (cont.) Notice the difference in the hair and forehead with respect to histogram equalization. 11
23 Contrast enhancement using fuzzy sets (cont.) The histogram expanded but its main characteristics were kept contrary to histogram equalization. 24 Spatial filtering using fuzzy sets A boundary extraction algorithm may have the 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 membership functions 12
25 Spatial filtering using fuzzy sets A simple set of rules: IF d 2 is zero AND d 6 is zero THEN z 5 =white IF d 6 is zero AND d 8 is zero THEN z 5 =white IF d 8 is zero AND d 4 is zero THEN z 5 =white IF d 4 is zero AND d 2 is zero THEN z 5 =white ELSEz 5 =black 26 Spatial filtering using fuzzy sets Membership functions (for input: zero, output: black and white) and fuzzy rules 13
27 Spatial filtering using fuzzy sets Membership functions (for input: zero, output: black and white) and fuzzy rules 14
Τέλος Ενότητας Χρηματοδότηση Το παρόν εκπαιδευτικό υλικό έχει αναπτυχθεί στα πλαίσια του εκπαιδευτικού έργου του διδάσκοντα. Το έργο «Ανοικτά Ακαδημαϊκά Μαθήματα στο Πανεπιστήμιο Ιωαννίνων» έχει χρηματοδοτήσει μόνο τη αναδιαμόρφωση του εκπαιδευτικού υλικού. Το έργο υλοποιείται στο πλαίσιο του Επιχειρησιακού Προγράμματος «Εκπαίδευση και Δια Βίου Μάθηση» και συγχρηματοδοτείται από την Ευρωπαϊκή Ένωση (Ευρωπαϊκό Κοινωνικό Ταμείο) και από εθνικούς πόρους.
Σημειώματα Σημείωμα Ιστορικού Εκδόσεων Έργου Το παρόν έργο αποτελεί την έκδοση 1.0. Έχουν προηγηθεί οι κάτωθι εκδόσεις: Έκδοση 1.0 διαθέσιμη εδώ. http://ecourse.uoi.gr/course/view.php?id=1126.
Σημείωμα Αναφοράς Copyright Πανεπιστήμιο Ιωαννίνων, Διδάσκων : Αναπληρωτής Καθηγητής Νίκου Χριστόφορος. «Ψηφιακή Επεξεργασία Εικόνας. Μετασχηματισμοί έντασης και χωρικό φιλτράρισμα». Έκδοση: 1.0. Ιωάννινα 2014. Διαθέσιμο από τη δικτυακή διεύθυνση: http://ecourse.uoi.gr/course/view.php?id=1126. Σημείωμα Αδειοδότησης Το παρόν υλικό διατίθεται με τους όρους της άδειας χρήσης Creative Commons Αναφορά Δημιουργού - Παρόμοια Διανομή, Διεθνής Έκδοση 4.0 [1] ή μεταγενέστερη. [1] https://creativecommons.org/licenses/by-sa/4.0/