Fuzzy Logic Edge Detection
CSE 6369 - Reasoning with Uncertainty
Joel Martin
Dec 8, 2015
"A New Fuzzy Approach for Edge Detection"
Yasar Becerikli and Tayfun M. Karan
Proceedings of the 8th International Workshop on Artificial Neural Networks, IWANN 2005
PDF
Background: Fuzzy Logic Models
- Mamdani
- Crisp output value using defuzzification
- More intuitive and human meaningful
- Sugeno (Takagi-Sugeno-Kang)
- Crisp output value using weighted averages
- Less intuitive but more efficient (no
output membership functions)
- The fuzzy logic model we focused on in class was the
Mamdani model: uses defuzzification to turn fuzzy output
set into crips output value.
- Sugeno model uses weighted averages to get directly
to a crisp output value.
- Mamdani is more human intuitive, but Sugeno is more
computationally efficient.
Background: Edge Detection
- Core component of most image and video analysis
algorithms especially feature dectection and extraction.
-
Edge: Boundary or abrupt change in an image.
Points (line segment) where image brightness changes
sharply.
- Commonly a 3x3 kernel is convolved with the source
image to produce a image representing detected edges.
- Convolution: apply a kernel to every pixel in source
image to create a new image.
Image Example
0.1
0.2
0.1
0.8
0.8
0.2
0.3
0.2
0.1
0.8
0.7
0.1
0.3
0.2
0.8
0.7
0.8
0.1
0.3
0.2
0.7
0.8
0.9
0.2
- Greyscale image with each pixel having a value of
0 for black to 1 for white.
Edge Detection: Sobel Kernel
- Horizontal:
-1
-2
-1
0
0
0
1
2
1
- Vertical:
-1
0
1
-2
0
2
-1
0
1
Edge Detection: Prewitt Kernel
- Horizontal:
-1
-1
-1
0
0
0
1
1
1
- Vertical:
-1
0
1
-1
0
1
-1
0
1
- Many other kernels for edge detection (like
Laplacian) and other purposes like image smoothing, etc.
Vertical Prewitt Mask Example
0.1
0.2 * -1
0.1 * 0
0.8 * 1
0.8
0.2
0.3
0.2 * -1
0.1 * 0
0.8 * 1
0.7
0.1
0.3
0.2 * -1
0.8 * 0
0.7 * 1
0.8
0.1
0.3
0.2
0.7
0.8
0.9
0.2
0.2*-1 + 0.2*-1 + 0.2*-1+ 0.8*1 + 0.8*1 + 0.8*1 = 1.7
Vertical Prewitt Mask Example
0.4
-0.2
1.2
1.3
-1.3
-1.5
0.6
0.2
1.7
1.3
-1.9
-2.3
0.6
0.7
1.7
0.8
-1.9
-2.4
0.4
0.9
1.1
0.2
-1.2
-1.7
Left edge threshold: ≥ 1.0
Right edge threshold: ≤ -1.0
- Same done with horizontal kernel, and the values are
summed together for a general edge or gradient value.
Gradients in Each Direction
Assign labels to 3x3 grid:
z1
z2
z3
z4
z5
z6
z7
z8
z9
Calculate gradients:
- ∇D1 = (z5 − z1)2 + (z9 − z5)2 (NW/SE Diagonal)
- ∇D2 = (z5 − z2)2 + (z8 − z5)2 (Vertical)
- ∇D3 = (z5 − z3)2 + (z7 − z5)2 (NE/SW Diagonal)
- ∇D4 = (z5 − z4)2 + (z6 − z5)2 (Horizontal)
- Now let's move from traditional edge detection to
using fuzzy logic.
- z5-z1 and z9-z5 is NW/SE diagonal gradient
- First...
Gradients in Each Direction
Approximation with absolute values (for efficiency):
- ∇D1 = |z5 − z1| + |z9 − z5| (NW/SE Diagonal)
- ∇D2 = |z5 − z2| + |z8 − z5| (Vertical)
- ∇D3 = |z5 − z3| + |z7 − z5| (NE/SW Diagonal)
- ∇D4 = |z5 − z4| + |z6 − z5| (Horizontal)
- Add absolute values instead of squares
Fuzzy Logic Rules
- K values can be modified to affect edge detection
Fuzzy Membership Sets
- fuzzy sets for gradient
- VL - very low, LO - low, MD - medium, HI - high, VH - very high
Directional Components
- For each angle a weighted average value is calculated across each gradient rule.
Final Edge Value
y = y̅1 + y̅2 + y̅3 + y̅4
- Every angle value is summed to create the general
gradient or edge value.
Results / Comparison
Original
Prewitt
Fuzzy
Conclusion
- Similar quality and computation efficiency to
traditional convolution edge detection methods.
- Added flexibility compared to traditional convolution
methods.
- Simple to implement (understandable)
Fuzzy Logic Edge Detection
CSE 6369 - Reasoning with Uncertainty
Joel Martin
Dec 8, 2015