- Open Access
- Total Downloads : 963
- Authors : Janvi Shah, Nupoor Patel, Hiral Tandel, Neelam Soni, Ghanshyam I Prajapati
- Paper ID : IJERTV2IS3496
- Volume & Issue : Volume 02, Issue 03 (March 2013)
- Published (First Online): 26-03-2013
- ISSN (Online) : 2278-0181
- Publisher Name : IJERT
- License: This work is licensed under a Creative Commons Attribution 4.0 International License
A Hybrid Approach For Edge Detection Using Fuzzy Logic And Canny Method
Janvi Shap, Nupoor Patel2, Hiral Tandel3, Neelam Soni4, Ghanshyam I Prajapati5
Department of Computer Science and Engineering, SVM Institute of Technology, Bharuch, Gujarat, India
ABSTRACT
An edge defines the boundaries among regions or objects in an image and hence edge detection helps to identify objects from the given images and also assists in image segmentation. Edge Detection from given images is fundamental operation in Computer Vision and Digital Image Processing. This research paper presents the fuzzy filter based canny Edge detection technique. This technique depends on fuzzy rule based system using 2 X 2 window mask which comprises sixteen fuzzy rules which are used to modify membership value of the image in three fuzzy sets, black, white or edge and this filtered image is given as input to canny edge detection technique. This approach gives improved results than traditional canny edge detection technique based on Gaussian filter for noisy images. Result of this technique is compared with various standard techniques like Sobel, Prewitt and Canny edge detection.
Keywords
Hybrid approach, fuzzy-canny, window mask, gray scaled image, defuzzification, non-maximum suppression
-
INTRODUCTION
Edges [1] are defined as a group of pixels where changing in intensity abruptly. Edges form the outline of object(s). Edge detection is one of the most commonly used operations in image analysis, and there are probably more algorithms in the literature for enhancing and detecting edges [2]. Edge detection is a useful task to extract clear edges of digital images in computer vision. Edge detection is required for an object recognition, feature detection, and image segmentation [3-5].
The basic steps [6] for edge detection are smoothing, enhancement, detection and localization. Various traditional edge detection techniques are available. Sobel edge detection technique [7] and Prewitt edge detection technique [8] have been implemented but these two techniques suffer from some drawbacks like edge displacement, vanishing edges and false edges.
Canny [9] proposed an edge detection technique by convolving a Gaussian filter in image. Canny is most commonly used technique due to it is better result compare to other traditional techniques. Canny is gradient based technique which uses Gaussian filter for smoothing an image. By applying no maximum suppression and thresholding edges are detected. It gives unsatisfactory result on low contrast images and noisy images.
Zadeh [10] proposed fuzzy set that is characterized by membership function which assigns membership value between 0 and 1to each object. Zhao, Fu and Yan [11] proposed an approach of three level thresholding by using fuzzy partitions to find the best edge of an image. They derived the conditions to maximize the entropy function due to which we get clear edges. Alshennawy and Aly [12] proposed fuzzy logic reasoning strategy using 3X3 masking which gave a permanent effect in the smoothness and straightness for the straight lines and better curved lines. In the same time the corners get sharper and can be defined easily [13-14] are various developed fuzzy edge detection techniques.
Fuzzy logic is a form of knowledge representation suitable for notions that cannot be define precisely, on their contexts. Fuzzy logic helps to highlight edges of an image. In this paper 2*2 pixel window is scan and fuzzy inference based system is developed for detecting edges. The rule base of 16 rules has been applied to mark the pixel as white, black or edge.
The logic of fuzzy filter is used in canny edge detection instead of Gaussian filter to overcome the drawback for low contrast image.
-
PROPOSED HYBRID APPROACH
In this paper, the hybrid approach is proposed and implemented. This approach suggests two phases for edge detection. First phase deals with fuzzy rule based system and second concerns about canny edge detection. This proposed has been implemented and the better results have been obtained for edge detection. The next sub-sections discuss about this proposed hybrid approach. The basic flow is shown in figure 1 and the same is explained in next coming sections with its results.
2.1 Fuzzy Rule Based System
After applying fuzzy rule based inference system [15] intermediate image is fetched. In this step original image is scanned and fuzzified and after applying fuzzy rules, membership function of pixels are modified. Then defuzzification using centroid method is applied and intermediate image is obtained.
4-pixel Input
4-pixel Input
Intermediate output
Phase 1
Fuzzy Rule Based Inference System
Fuzzy Rule Based Inference System
Finding Gradient
Finding Gradient
Finding Direction
Finding Direction
Phase 2
of 0 and 255, where 0 is with black color and 255 with white color. But in binary image, the pixel value 1 (one) is considered as white and the pixel value 0 (zero) as black.
(X,Y)
(X+1,Y)
(X,Y+1)
(X+1,Y+1)
Figure 2: Window Mask
C. Fuzzy set and Fuzzy Inference Rules
The output pixels are divided in to three fuzzy sets; Black, Edge and White. The ranges of the output fuzzy sets are as given in table 1 [12].
The Fuzzy Inference System checks for the conditions of the Fuzzy rules with the four input pixels and retrieves the resultant pixel that is Black, Edge or White as an output.
Non-maximum suppression
Non-maximum suppression
Thresholding
Thresholding
Table 1 : Range Of Fuzzy Output Set
Output
Pixel Name
Range
Pout
Black
[0 4 8] Edge
[130 133 136] White
[247 251 255] Final Output
Final Output
-
Scanning
Figure 1: Flow of Hybrid Approach
In this approach, 2 X 2 window mask, as shown in figure 2, is used for scanning an input image. Here 4 pixel values are obtained which are used as input in FIS (Fuzzy Inference System). After applying fuzzy inference rules, the output pixel will be (X,Y).
-
Membership Function
In this hybrid approach, triangular Membership function is used for input and output to express fuzzy property. Two types of fuzzy sets are used as inputs i.e. Black (or bit = 0) and White (or bit =1 ) and three types of fuzzy sets are used as outputs i.e. Black(B), White(W), and Edge(E). In the gray scaled images, values of pixels are always between the range
Algorithm: Phase-1
Input: Original Image
Output: Intermediate Image
Step 1: Convert the original image in to gray scale image Step 2: The gray- scaled image is scanned by 2 X 2
window mask.
Step 3: The 4-scanned pixels are taken as a crisp input for FIS system, to beconverted into linguistic variable i.e. black and white, by using triangular membership function.
Step 4: Fuzzy rules are then applied on fuzzy input to get fuzzy output either as black, white or edge.
Step 5: Fuzzy output is defuzzyfied using centroid method to get the intermediate output.
End of Algorithm: Phase -1
Algorithm: Phase-1
Input: Original Image
Output: Intermediate Image
Step 1: Convert the original image in to gray scale image Step 2: The gray- scaled image is scanned by 2 X 2
window mask.
Step 3: The 4-scanned pixels are taken as a crisp input for FIS system, to beconverted into linguistic variable i.e. black and white, by using triangular membership function.
Step 4: Fuzzy rules are then applied on fuzzy input to get fuzzy output either as black, white or edge.
Step 5: Fuzzy output is defuzzyfied using centroid method to get the intermediate output.
End of Algorithm: Phase -1
Figure 3: Algorithm of Phase-1
Table 2 : Fuzzy Rules
Rule-1
If{(In(X-1,Y-1) &In(X-1,Y) & In(X,Y-1) &
In(X,Y))black}
Out(X,Y)black
Rule-2
If{(In(X-1,Y-1) &In(X-1,Y) & In(X,Y-1) )black}
If{(In(X,Y)white}
Out(X,Y)edge
Rule-3
If{(In(X-1,Y-1) &In(X-1,Y) & In(X,Y) )black}
If{(In(X,Y-1)white}
Out(X,Y)edge
Rule-4
If{(In(X-1,Y-1) &In(X-1,Y) black} If{(In(X,Y-1) &
In(X,Y) )white}
Out(X,Y)edge
Rule-5
{If(In(X-1,Y-1) & In(X,Y-1) & In(X,Y))black}
{If(In(X-1,Y)white}
Out(X,Y)edge
Rule-6
{If(In(X-1,Y-1) & In(X,Y-1))black}
{If(In(X-1,Y) & In(X,Y)white}
Out(X,Y)edge
Rule-7
{If(In(X-1,Y-1) & In(X,Y))black}
{If(In(X-1,Y) & In(X,Y-1))white}
Out(X,Y)edge
Rule-8
If{(In(X-1,Y-1) black}
If{((in(X,Y-1) & in(X-1,Y) & in(X,Y))white}
Out(X,Y)edge
Rule-9
If{(In(X-1,Y-1) white}
If{((in(X,Y-1) & in(X-1,Y) & in(X,Y))black}
Out(X,Y)edge
Rule-10
If{(In(X-1,Y-1) & In(X,Y))white}
If{(In(X-1,Y) & In(X,Y-1))black}
Out(X,Y)edge
Rule-11
If{(In(X-1,Y-1) & In(X,Y-1))white}
If{(In(X-1,Y) & In(X,Y)black}
Out(X,Y)edge
Rule-12
If{(In(X-1,Y-1) & In(X,Y-1) &In(X,Y))white}
If{(In(X-1,Y)black}
Out(X,Y)edge
Rule-13
If{(In(X-1,Y-1) &In(X-1,Y) white}
If{(In(X,Y-1) & In(X,Y) )black}
Out(X,Y)edge
Rule-14
If{(In(X-1,Y-1) &In(X-1,Y) & In(X,Y) )white}
If{(In(X,Y-1)black}
Out(X,Y)edge
Rule-15
If{(In(X-1,Y-1) &In(X-1,Y) &In(X,Y-1))white}
If{(In(X,Y)black}
Out(X,Y)white
Rule-16
If{(In(X-1,Y-1)&In(X-1,Y) & In(X,Y-1) &
In(X,Y))white}
Out(X,Y)white
There are 16 rules for the 4-pixel input to get output fuzzy set as shown in the table 2 [12]. In indicates input pixel, Out indicates output pixels, X and Y are coordinates of pixel. The
algorithm for phase-1 is shown in figure 3. A colored image is given as an input image and phase-1 gives resultant image and
same can be applied as an input to phase-2. The results of phase-1 is shown in figure 4.
Figure 4: (a) An input image (b) Resultant image after phase-1
and suppress any pixel value that is not considered to be an edge. This will give a thin line in the output image.
-
Thresholding: Double thresholding approach is used which removes streaking and considers the edges that falls between two threshold values.
After applying the steps (shown in figure 5), the fuzzy-Canny output is generated and the result of the fuzzy-canny logic is
as shown in figure(a6).
(b)
-
(b)
-
-
-
Fuzzy-Canny Logic
The Fuzzy output retrieved from the Fuzzy Inference System is considered as an input to canny edge detection technique. An algorithm for phase-2 is shown in figure 5. The steps for canny edge detection method[9] are :
-
Finding the Gradient: The gradient magnitude of an image is obtained in x and y directions that indicate the edges quiet clearly.
Algorithm: Phase-2
Input: Intermediate Image from phase 1.
Output: Resultant fuzzy canny output image with edge detection.
Step 1: the gradient and direction of intermediate output image is calculated.
Step 2: By applying non-maximum suppression, weak edges are suppressed to get thin line.
Step 3: After using double thresholding final output image is obtained.
End of Algorithm: Phase -2.
Algorithm: Phase-2
Input: Intermediate Image from phase 1.
Output: Resultant fuzzy canny output image with edge detection.
Step 1: the gradient and direction of intermediate output image is calculated.
Step 2: By applying non-maximum suppression, weak edges are suppressed to get thin line.
Step 3: After using double thresholding final output image is obtained.
End of Algorithm: Phase -2.
-
Finding the direction: The direction of the edge is computed using the gradient in the x and y directions.
Figure 5: Algorithm of Phase-2
-
Non-maximum Suppression: After the edge directions are known, non-maximum suppression is used to trace along the edge in the edge direction
-
Figure 6: (a) intermediate result from phase-1 (b) Resultant image after phase-2
-
RESULTS ANALYSIS
The proposed hybrid approach is implemented in Matlab and gives improved results than classical canny method. Figure 7 to figure 10 show the results obtained by proposed hybrid approach. In these figures, (a) is colored input image, (b) gives detected edges from input images using classical canny edge detection method and finally, (c) shows the resultant image after application of hybrid approach. In figure (b) and figure (c), red colored bubble is shown, the same indicate the differences between the results obtained by classical canny method and the proposed hybrid approach. From visual perceptions, figure (c) gives accurate and more improved results than figure (b).
In case of threshold, single or double, we may obtain better results. But the difficult thing is value of threshold. There is no any general guidelines are available for value of threshold.
-
CONCLUSION
In this paper, from the comparison, it can be concluded that in Canny edge detection technique the low intensity edge of an image is eliminated. While the hybrid approach or Fuzzy- canny technique takes into consideration the low level intensity edges. Another drawback of canny edge detection technique was the increased noise level of images which contains its shadow whereas such images have improved result in fuzzy-Canny technique.
Figure 7: (a) Input image (b) Results By Canny Method (c) Results by Hybrid Approach
Figure 8: (a) Input image (b) Results By Canny Method (c) Results by Hybrid Approach
Figure 9: (a) Input image (b) Results By Canny Method (c) Results by Hybrid Approach
Figure 10: (a) Input image (b) Results By Canny Method (c) Results by Hybrid Approach
-
REFERENCES
-
R. C. Gonzalez and R. E. Woods.Digital Image Processing.3rd ed. Prentice Hall, 2008, pp.423-424, pp.714-747.
-
M.B. Ahmad and T. S. Choi , Local Threshold and Boolean Function Based Edge Detection, IEEE Transactions on Consumer Electronics, Vol. 45, No 3. August 1999.
-
S. Belongie, J. Malik and J. Puzicha, Shape Matching and Object Recognition using Shape Contexts, IEEE Transactions on Pttern Analysis and Machine Intelligence, Vol 24, No 24, 509 – 522, April 2002.
-
M. Tabb and N. Ahuja, Multiscale Image Segmentation by Integrated Edge and Region Detection, IEEE Transactions on Image Processing, Vol. 6, No. 5, 642 655, May 1997.
-
Cui, Feng-ying Zou, Li-jun and Song, Bei, Edge feature extraction based on digital image processing techniques, IEEE International Conference on Automation and Logistics, pp 2320 2324, 2008.
-
Webpage : www.cse.unr.edu/~bebis/CS791E/Notes/ Edge Detection.pdf , visited on 4th March 2013.
-
E. Sobel. Camera Models and Machine Perception.PhD thesis, Electrical Engineering Department, Stanford University, 1970.
-
J. M. S. Prewitt, "Object enhancement and extraction," in Picture Processing and Psychopictorics, B. Lipkin and A.
Rosenfeld, Eds.New York: Academic, 1970, pp. 75-149
-
J. F. Canny. A computational approach to edge detection.IEEE Trans. Pattern Analysis and Machine Intelligence, vol. PAMI-8, no. 6, pp. 679-697, 1986.
-
L. A. Zadeh, Fuzzy sets, Information and Control, 8: 1965, pp. 338-353.
-
M. Zhao, A. M. N. Fu, and H. Yan, A Technique of Three-Level Thresholding Based on Probability Partition a Fuzzy 3-Partition.IEEE Trans. on Fuzzy Systems, vol.9, no.3, June 2001, pp. 469- 479.
-
Abdallah A. Alshennawy, and Ayman A. Aly, Edge Detection in Digital ImagesUsing Fuzzy Logic Technique. World Academy of Science, Engineering and Technology 51 2009.
-
G. Mansoori and H. Eghbali, Heuristic edge detection using fuzzy rule-based classifier, Journal of Intelligent and Fuzzy Systems, Volume 17, Number 5 / 2006, pp. 457- 469.
-
H. Farahanirad, J. Shanbehzadeh, M. M. Pedram, A.Sarrafzadeh, A Hybrid Edge Detection Algorithm for Saltand-Pepper Noise, Proceeding of the International MultiConference of Engineers and Computer Scientists 2011 VOl I, IMECS 2011, March 16-18, 2011, Hong Kong
-
Aijaz Ur Rehman khan, Kavita Thakur An Efficient Fuzzy Logic Based Edge Detection Technique for Gray Scale Image ISSN 2250-2459 , Volume 2, Issued 8, August 2012, 246