Multi-level threshold based edge detector using logical operations

Edge detection is a very significant feature of image processing and refers to the algorithms, which are intended for identifying points in a digital image where the image intensity changes significantly. The need of edge detection is to find the discontinuities in intensity, surface direction, change in texture properties, and variation in scene illumination. This paper proposes a rapid and superior edge detection technique, which uses the logical operations on circularly shifted images to efficiently detect the edges with lesser computational complexity. The results are compared with other edge detectors using 2-dimensional Fourier transform. Experimental results show that the proposed algorithm improves detection accuracy and possesses encouraging robustness when applied to different images, in comparison to several other edge detection algorithms. Moreover, the algorithm is also applied on a bio-medical application to segment blood cells to show the diversified nature of the proposed algorithm.


INTRODUCTION
Edge detection is a procedure for finding significant changes in an image.Edges are basically the points where sharp changes in brightness occur, which arises typically from the borders between different objects (Jayaraman et al., 2010).The main purpose of an edge detection technique is to simplify the image data in order to minimise the amount of data to be processed (Canny, 1986).The variables involved in the selection of an edge detection operator include edge orientation, noise environment and edge structure (Huertas & Medioni, 1986).The operator geometry defines a specific direction in which it is most sensitive to the edges.Edge detection becomes a challenging task when the image contains added noise, since both the noise and the edges contain high frequency content.The efforts to reduce the noise in an image before edge detection result in blurred and inaccurate edges (Selvarajan & Tat, 2001).The operators used on noisy images are normally larger in scope, therefore they can average enough data to mark down the localised noisy pixels.This results in less precise localisation of the identified edges.However, all the edges do not contain a step variation in intensity, because the properties such as refraction or poor focus can result in objects with borders defined by a gradual variation of intensity (Argyle & Rosenfeld, 1971).Many algorithms have been suggested for analysing image intensity variation, including statistical methods (Nahi & Assefi, 1972;Huang & Tseng, 1988;Stern & Kurz, 1988), difference methods (Prewitt, 1970;Marr & Hildreth, 1984) and curve fitting methods (Haralick, 1984;Nalwa & Binford, 1986).Edge detection in a noisy environment can be viewed as an optimal linear filter design problem (Torre & Poggio, 1986;Manjunath & Chellappa, 1993).Canny (1986) framed edge detection as a problem of optimisation and defined an optimal filter, which can be proficiently approximated by the first derivative of a Gaussian function in one-dimensional case.
A new mathematical theory known as mathematical morphology has emerged for de-noising, feature extraction and recognition.In the mathematical morphology theory, images are taken as sets and morphological transformations, which are derived from Minkowski addition and subtraction, are defined to get features in images (Yang et al., 2010).The efficiency of edge detectors can also be increased by optimising the boundary extraction using ant colony optimisation (Ari et al., 2014).

June 2016
Journal of the National Science Foundation of Sri Lanka 44 (2) In this paper, a new edge detection technique is proposed, which selects the optimum threshold values for extracting the binary image map from grayscale images.The shift and logical operations are performed on the extracted binary images, which provide the optimum edge detected data.According to 2-dimensional Fourier analysis of the image, low frequency components contribute to the basic shapes of the objects in the image.However, the sharpness of the objects and the borders between the objects are confined to high frequency components (Gonzalez & Woods, 2002).So, the edge detected image will contain only the high frequency components, which is used for visual comparative analysis of the proposed and other edge detectors.
The optimal edge detection algorithm can be applied to a variety of application scenarios, out of which image based blood cell segmentation possesses a huge research potential.There is substantial proof indicating that RBC (red blood cell) deformability is a significant factor in the filterability of blood and later in the pathology of numerous diseases including acute lymphoblastic leukaemia, chronic lymphocytic leukaemia, infectious mononucleosis and sickle cell anaemia etc.Furthermore, the shape of erythrocytes (RBC) is directly linked to its deformability and hence its filterability (Vromen & McCane, 2009).Various techniques such as edge detection, thresholding, region growing, cluster, active contour and watershed transforms are available for segmentation (Rane et al., 2014).Edge detection method has many advantages such as energy minimisation and easy implementation and it also emulates the ability of human visual system, which makes it a superior method compared to the other methods.

PROPOSED SYSTEM MODEL
The proposed edge detection is performed in three stages: first the grayscale image with a resolution of 8 bits/pixel is down-sampled to multiple binary images (1 bit/pixel) for different threshold levels selected optimally using the algorithm specified in Arora et al. (2008).Then, the binary images are circularly shifted left, right, up and down.Finally, the binary shifted images for each threshold are logically operated to obtain the final edge detected binary image.Figure 1 depicts the flow diagram of the proposed edge detection technique.The subsequent sections explain in detail, the methodology followed for each stage of the proposed algorithm.

Optimal threshold level selection
The selection of optimal threshold level is a very important process.The down conversion of image resolution from 8 bits/pixel to 1 bit/pixel is accomplished using the selected optimal threshold levels.The image function for a particular threshold level can be given as: 0, ( , ) ( , ) 1, ( , ) where f (x,y) is the grayscale image of size M × N pixels, with x = 1, 2, ..., M and y = 1, 2, ..., N, g (x,y) is the output binary image, and T is the selected optimum threshold level.
The threshold levels were selected optimally using the algorithm given in Arora et al. (2008) and reproduced here for convenience.The free parameters α and β control the sub-range span to guarantee that the sub-range does not include more than one structure (object), or a single structure (object) does not broaden beyond a specific sub-range.This averts the clustering of different objects within a small range.Moreover if the image has a skewed/asymmetric histogram, the free parameters can be adjusted to improve the quality of the down converted image without the added burden of computational complexity and time (Arora et al., 2008).For simplicity, the free parameters α and β are chosen to be 1.
The number of thresholds, N T , can be chosen according to the application under consideration.After obtaining the optimal threshold levels for the grayscale image, multiple binary images are computed for each threshold level, using equation (1).

Circular shift operations
The multiple down-converted binary images for each threshold level is circularly shifted in all four directions -left, right, up and down.The shift operations are circular in nature to ensure that the edges in the last rows and/ or columns of the image are restored in the first rows and/or columns when shifted.The shift operations are performed on the images as follows:  For all the above operations, i = 1, 2, ..., N T , where N T is the number of threshold levels and k = 1 is considered for the experimentation.

Logical operations
Logical operations are performed on the four direction circularly shifted images, for each threshold level, to obtain the final edge detected binary image.The performed logical operations are as follows: where . is a logical AND operation.The resulting images are operated further as where + represents logical exclusive-OR (XOR) operation.
The XOR operated images are operated to get edge detected image for a particular threshold as where + represents logical OR operation.The same process is repeated for all the threshold levels and finally, the edge detected images are added to get the final edge detected binary image.

RESULTS AND DISCUSSION
To investigate the utility and demonstrate the efficiency of the proposed approach, we carried out computer simulation experiments on grayscale images.The tests have been divided into two cases.In case 1, the proposed algorithm has been applied on traditional images (including IEEE standard images) named 'boxes' 'house' and 'cameraman' as in Figures 2 -4.In case 2, the utility of algorithm is shown by applying it for blood cell segmentation on sample 1, sample 2 and sample 3, as in Figures 5 -7.All these blood cell samples have been downloaded from the University of Utah Eccles Health Sciences Library and Sickle Cell Open.Both visual comparison and statistical parameter calculation have been done to find out the efficiency of the proposed technique.We also calculated the 2-dimensional Fourier transform (2D-FT) of the original as well as the proposed technique to compare the results.The 2D-FT in image processing permits one to see the frequency spectrum of the data in both dimensions and one can visualise filtering processes more profoundly.The characteristics of the image from which the spectrum was created is provided by the useful information of the 2D-FT spectrum (Gonzalez & Woods, 2002).The intensity values in the 2D-FTed image are too low to be displayed on the screen and therefore all the other values appear as black.But if we apply log transformation to the image, we obtain an image, which constitutes of all frequencies.High frequencies in 2D-FT correspond to rapidly varying intensities in the image, which lie a little far from the centre of the spectrum.However, low frequencies in 2D-FT correspond to slow variation in the intensities of the image, which lie near the centre of the spectrum.
The edges in an image correspond to high frequency content in the 2D-FT spectrum.The filtration of low frequency components from the original image spectrum should only correspond to sharp and rapidly varying intensities in an image.The edge detected image will only have the high frequency components, which will be as same as that of the original image.So a better edge detector will retain all the high frequency components but not the low frequency components and this metric can be used to evaluate the accuracy of any edge detection technique.

Case 1
To demonstrate, different images have been taken and their 2D-FT have been evaluated.The images were subjected to various edge detectors such as Canny (1986), morphological (Yang et al., 2010), LoG (Huertas & Medioni, 1986) and Ari et al. (2014), which are then compared with the proposed algorithm on the basis of 2D-FT spectrum.It is quite clear from the results that the proposed technique detected more edges as demonstrated in Figures 2 -4.
To confirm the performance of the proposed technique, we further evaluated the statistical parameter Kappa (Ben-David, 2008) for every edge detection method.Kappa coefficient is a measure of statistical amount of inter-annotator reliability.It is usually thought to be a better measure than simple percent agreement calculation since it takes into account the agreement occurring by chance.It is used to calculate the amount of agreement between two observers observing similar phenomenon and compensate the agreements that are occurring by chance.The Cohen's coefficient of Kappa is given as ... (10) where P a represents the probability of total agreement and P c represents the probability of agreement due to chance, which lies in the range [-1, 1].The Cohen's coefficient of Kappa has been evaluated for different images in consideration, which are depicted in Table 1.

Case 2
Detection of RBC has been done using the circular Hough transform (CHT) based algorithm for finding circles in images.This approach is used because of its robustness in the presence of noise, occlusion and varying illumination (Gonzalez & Woods, 2002;Jayaraman et al., 2010).In Figure 9, bold line objects represent red blood cells and thin line objects represent sickle cells.The accuracy of the proposed method is depicted in Table 2. To confirm the performance of the proposed technique, we further evaluated the statistical parameter of the time taken for every edge detection method.It is usually thought to be a better measure because it gives exact information about the maximum time a particular method takes.T E is the time taken for edge detection algorithm and T T is the total time taken by the algorithm for shape detection.The time taken by the proposed algorithm is minimum for every sample, even for the computation of edges as shown in Table 3 and Figure 10.The total time taken for shape detection includes edge detection and all the necessary algorithms for detecting the shape (circle and sickle), and highlighting the appropriate shape.The main reason behind the lesser time of evaluation of the proposed work is that the proposed algorithm works on the whole image at a time, whereas in other techniques a mask of smaller size is used to find the edges.Moreover, the number of thresholds gives the flexibility of the amount of edges to be detected.Lesser the number of thresholds, lesser will the edges detected and lesser will be the computational time.Furthermore, if the number of thresholds is less, the pre-requisite algorithms for shape detection can be skipped.

CONCLUSION
This paper introduces a technique for edge detection using logical operations.The final edge detected output of the proposed method is more accurate than the existing edge detectors, as illustrated via different simulations/experiments.Since the proposed algorithm takes into account the whole image matrix at once, the computation of the edge detected result takes much lesser time than the other techniques, which make use of structuring elements/masks for carrying out the desired operation.
The performance of the proposed algorithm is compared with many other existing methods, such as Canny (Canny, 1986), morphological (Yang et al., 2010), LoG (Huertas & Medioni, 1986) and Ari et al. (2014) detectors.Experiments were conducted on a variety of images and the results show that the proposed algorithm not only suppresses the Gaussian noise effectively, but also preserves edges in a clear and crisp manner.The visual, Fourier, and statistical analysis of the final edge detected images confirm that the proposed method outperforms the other edge detectors that are widely used in the field of edge detection.

1 . 2 TN
Take range K = [a, b]; initially a = 0 and b = 225, for 8 bits/pixel images.2. Compute standard deviation (S D ) and mean (M T ) for all pixels in the range K. 3. Calculate sub-ranges' boundaries as T 1 = M T -αS D and T 2 = M T + βS D , where α and β are free parameters.4. The pixels with intensity values in the interval [a, T 1 ] are assigned the value T 1 and pixels with intensity values in the interval [T 2 , b] are assigned the value T 2 .5. Update a and b as a = T 1 + 1 and b = T 1 -1.6. Repeat step 4 with T 1 = M T and T 2 = M T + 1. 7. Finally, repeat steps 1 -6 for 1 − times; where N T is the number of thresholds.

Figure 1 :
Figure 1: The flow diagram of proposed system model of edge detection using logical operations

Figure 10 :
Figure 10: Time comparison for different algorithms N,where k is the degree of shift.

Table 2 :
Count of RBCs and sickle cells detected

Table 3 :
Time taken for different edge detected images

Table 1 :
Kappa coefficient for different edge detected images