Mini Kirsch Edge Detection and Its Sharpening Effect

Received Jul 6, 2020 Revised Mar 12, 2021 Accepted Mar 17, 2021 In computer vision, edge detection is a crucial step in identifying the objects’ boundaries in an image. The existing edge detection methods function in either spatial domain or frequency domain, fail to outline the high continuity boundaries of the objects. In this work, we modified four-directional mini Kirsch edge detection kernels which enable full directional edge detection. We also introduced the novel involvement of the proposed method in image sharpening by adding the resulting edge map onto the original input image to enhance the edge details in the image. From the edge detection performance tests, our proposed method acquired the highest true edge pixels and true nonedge pixels detection, yielding the highest accuracy among all the comparing methods. Moreover, the sharpening effect offered by our proposed framework could achieve a more favorable visual appearance with a competitive score of peak signal-to-noise ratio and structural similarity index value compared to the most widely used unsharp masking and Laplacian of Gaussian sharpening methods. The edges of the sharpened image are further enhanced could potentially contribute to better boundary tracking and higher segmentation accuracy.


INTRODUCTION
Edges in a digital image are the pixels where their gray level intensity changes abruptly compared to their local neighbouring pixels. In the application of image processing, machine vision, and computer vision, edge detection is one of the crucial steps in pre-processing stages for finding the boundaries of objects within an image, for instance detecting local discontinuities in pixels intensity or brightness for boundaries extraction [1]. Edge detection is widely implemented in the application of car's license plate detection [2], human face recognition through iris localization for eye tracking [3], synthetic aperture radar images to detect edges of ships, aircraft, terrain, meteorological forms and mobile vehicles [4], agricultural plant leaves recognition [5], and dehaze or deblurring method [6]. Furthermore, biomedical image, i.e. magnetic resonance image (MRI) [1] [7], ultrasound, X-ray, and computerized tomography (CT) scan segmentation is a challenging task with the existence of speckle noise, its poor luminance and indistinctive contrast [8] which cause difficulties in identifying the edges [9][10] [11] [12].
The existing edge detection algorithms that are implemented in the spatial domain can be generally divided into two groups: gradient-based and Gaussian-based [13]. Examples of gradient-based edge operators are Sobel, Prewitt, Roberts, and Canny. Meanwhile, Laplacian of Gaussian (LoG) is categorized under the gaussian-based method, refer to Table 1. Gradient-based operators are filters with different kernel sizes which are then convolved with the original input image to obtain its image gradient. Gaussian-based methods are also known as zero-crossing or second-order derivative methods. The Canny operator is well-known for its outstanding performance as it undergoes smoothing operation for noise reduction, gradient magnitude computation as gradient operators, thresholding to keep strong edges while removing the weak one and finally non-maximum suppression for edge thinning process [14]. Sharpening is another crucial stage to boost the edge detection performance. It helps to emphasize the tiny details and boundaries of objects in an image [15]. Generally, it is carried out at the post-processing stage to enhance the overall image visuality and quality. It can also work together with the edge detection operators to result in a better edge segmentation. There are two well-known and most popular sharpening algorithms: Gaussian high pass filter and unsharp masking method.
Existing gradient-based edge detectors benefit in terms of simplicity and gradient estimation in several directions. On the other hand, the approximation could be affected by the level of noise and the magnitude of edges [16]. Overall, these operators cannot result in accurate edge detection especially those thin and faint edges. Mini Kirsch edge detection method with four-directional filters was proposed to detect edges of an object from all angles. Inherit from the original Kirsch edge detection method with eight-directional filters, the maximum edge magnitude was measured across all gradient magnitude in all directions. The normalized edge detection result was then added to the original input test image for the sharpening effect. The edge detection performance of the proposed method was compared with Sobel, Prewitt, Roberts, LoG, Canny, and Kirsch algorithms while its sharpening effect was examined together with unsharp masking and LoG.

RELATED WORKS
For gradient-based or first-order methods, edge detection is carried out by convolving the kernels along the input image to measure its gradient magnitude. Meanwhile, gaussian-based or second-order approaches capture local maxima of the image gradient, the process is also named as zero-crossings of the Laplacian operator. To yield a better edge detection result, a smoothing process, typically Gaussian smoothing and anisotropic diffusion, will be done in pre-processing step [16] [17]. As reported by Iskandar, Gaussian filter kernel size is critically important to result in different levels of the blurred image. Greater filter size could expect a blurrier output image. Therefore, the non-local means (NLM) filter is suggested to replace the Gaussian smoothing filter as it evaluates the similarity of the pixel with nearby pixels, taking into consideration not only their intensity difference but also from the whole spatial neighbourhood [1]. Another published framework has proven that the canny method could be further improved with an appropriate Gaussian filter for effective white noise reduction by extending its image gradient magnitude with the Sobel algorithm [16]. A threshold is normally applied after the computation of edge magnitude to decide whether an edge pixel is to be kept. More edges will be detected when the threshold set is low and vice versa. Assisted by adaptive thresholding, edges of human iris and pupil resulted from Sobel operators and three points are selected randomly to generate a circle for human eye localization [3]. With a high threshold value, we might miss subtle edges, or most of the time output undesired edge fragments. Statistically, it is being proven that the combination of search spaces could help in faint edge detection, the authors also use two different algorithms for both straight and curved edge detection [18]. To detect sharp changes in image field depth, a multi-scale filter window is suggested, such as using 5 x 5 window for regions with larger field depth transformation while 15 x 15 window size for regions with smaller field depth transformation [6].
The author implements eight-directional edge operators to field the depth of the image and apply a guide filter to enhance the edges in the image, later the texture difference between the original image and the edge-enhanced image is measured to dehaze the foggy image. Images are taken under different light intensities, the objects in the images could be exposed to the light unevenly which affects the edge detection accuracy severely. Some faded edges might appear to be too soft for detection. Therefore, log Sobel is proposed to process optical density to remove the uneven illumination intensity. The algorithm is backed with photography technology utilizing the proportional relationships between the logarithm of light intensity and the logarithm of the object's reflectivity [19].
Edge detection in a colour image with anisotropic morphological directional derivative matrix (AMDD) is more resistant towards noises like Gaussian and impulsive noises [20]. More colour image existing edge detection algorithms are color Canny [21], PCA-GOHD [22], RCMG-MM [23] and ColorED [24]. Edge detection in colour images consumes a longer time as the detection is required to be carried out in every colour channel. Another interesting novel finding by Delgado shows that edge detection could be done without a fixed kernel. A non-local fractional mask is designed, the parameters take account of visual perception and its statistical analysis, allowing it to extract more fine image details from overall spatial information [25]. Besides, there is a study on edge detection in the frequency domain with the framework that connects Ridgelet transform, Bezier curve, and Sobel operator. Ridgelet transforms threshold the existing noises while Bezier curve can perceive the details to avoid huge deviation of data [4].
Image sharpening is defined as an acutance improvement that enhances the apparent quality (edge information, contours, texture, etc.) without changing the content in the image. Furthermore, a good sharpening algorithm aims to improve the image details without adding unwanted and excessive artifacts that can decrease the image quality and increase the difficulties in image segmentation later. In recent years, research on image sharpening has been growing actively due to its existing challenges, including the over-sharpening effect, amplification of latent noise, overshoot and others. Among the existing sharpening algorithms, various popular techniques are Laplacian filtering, unsharp masking (UM) [10], shock filtering and local neighbourhood operators [15] [26]. Zohair proposed a nimble filter, a single kernel to obtain specific spatial information from the input image and deduct it from the original image with certain weighting parameters to control the level of sharpness improved [15]. The spatial information is computed by measuring the mean of both horizontal and vertical shifts of the input image, then it generates a blurry image that highlights its edge structures. The method is inconvenient since the weight parameters must be manually pre-determined to yield a satisfactory result. Inspired by Zohair, Lin et al. suggested measuring the gradient norm value of every single pixel to be calculated and acts as a reference on determining the categorization of a particular pixel to the edge. Meanwhile, the edge can be identified by taking the turnover points from the second derivative of a curve produced previously. The proposed scheme successfully preserves the edges and amplification of noises [27]. UM is a classical image sharpening method, which is available in most consumer products like cameras and photo editing tools (i.e. Adobe Photoshop). An unsharp mask, in other words, a smoothed image from the corresponding image, is obtained by conducting a smoothing process of the original image with a Gaussian filter. The unsharp mask includes high-frequency information and edge details. Later, the mask is added to the original image which potentially emphasizes the noise. Chen et al. claimed that reverse anisotropic diffusion (RAD)-based technique to be the successor of UM method as not only edges are preserved, but also the salient details in the image. The original anisotropic diffusion model has a characteristic of smoothing images while preserving the edges along the boundary of the objects. Different case to RAD-based UM, reverse anisotropic diffusion tends to smooth the edges while keeping noise in the image [10].
Another innovative work to extend Hausdorff derivatives to image sharpening. The Hausdorff derivative Laplace equation (HDLO) is computed through Hausdorff fractal distance [32]. A hybrid deblurring strategy introduced by Chang et al. tends to process strong edges and weak edges separately. The author applied a patch-based method to sharpen the existing strong edges while using bilateral filtering to remove the noise and smooth edges [26]. Canny edge detection provides double threshold values, high and low thresholds, which are critically important to filter out the weak edges while retaining the strong edges. Therefore, the performance of the proposed model is heavily dependent on the choice of both threshold values.

Software and Computer Specification
All the algorithms and performance tests mentioned are run through MATLAB 2019a on a laptop hosting Intel Core i7-6700HQ quad-core with hyper-threading clocked at 2.6 -3.5GHz, 8GB DDR4 RAM, and NVIDIA GTX960M (4GB GDDR5 RAM).

Proposed Mini Kirsch Detection Kernels
The original Kirsch operator is a non-linear edge detector that takes a single 3 x 3 kernel and rotates it in 45 degrees to form a total of eight-directional operators. The directional kernels operate through eight different directions: north, northwest, west, southwest, south, southeast, east and northeast. Every kernel will produce a different image gradient map through simple convolutional processes. Later, the maximum magnitude is chosen among the eight gradient maps and finally results in a complete image gradient map. Overall, Kirsch operators manage to delineate the structure of objects in the image. Inspired by Kirsch operators, we proposed to modify the operators by reducing the kernel size to 2 x 2 which could achieve satisfying performance with only four-directional kernels Similarly, the final edge magnitude map is obtained through the computation of maximum gradient magnitude across all four image gradient maps with the equation: Where indicates the input image size and ℎ represents the parts of pixel location to be convolved with 2 × 2 kernels ( ) across all the pixels in the images. The brightness of a particular pixel is measured based on its nearby pixels. If all the pixel intensities within the convolution window are similar, we could say there is no edge point at that particular location. For instances, kernel (1) manages to identify the edges that fall in the northwest, west and also north direction. Meanwhile, kernel (2) can detect edges pointing southwest, west and south. With these four aforementioned kernels, we can expect the edges detected to be covered throughout all the directions.
Referring to Figure 1, the grayscale image of an air jet is input into the system. Four gradient magnitude maps are yielded from the convolution between the kernels with the input image. Every kernel detects its corresponding edges respectively and therefore outputs its gradient map differently. After combining the four resulting gradient maps by taking maximum magnitude across the maps, the output pixels might contain negative and non-integer values, and therefore normalization should be done to normalize the pixel values ranging from 0 to 255.
The normalized map with edge enhancing details is added back to the original input image to sharpen the image. However, adding two images might cause the image to be brighter as the intensities might be shifted towards the brighter side of the histogram. At the same time, the image contrast could be badly influenced. Hence, contrast enhancement is critically important to recover the visuality and the illuminance of the output image. In this paper, linear contrast enhancement is applied to stretch the intensity distribution to enhance the overall image quality. We can observe a better edge presentation in the output air-jet image after the proposed sharpening method.

Sample Images and Edge Detection
All the images in Table 2 and Figure 2, and their ground truth edge maps tested in the edge detection section were obtained from Berkeley Segmentation Dataset [33]. The mammogram in Figure 3 was obtained from [34], aneurysm image in Figure 4 was retrieved from [35], brain MR image in Figure 5-1a from [36], funduscopic images ( Figure 5-2a) was provided by the Department of Ophthalmology at school of Medical Sciences, Universiti Sains Malaysia and 3-Tesla knee MR scan was retrieved from [37]. Meanwhile, images in Figure 6 were obtained from [38], [39], and [40].

Edge Detection Comparative Test
Ground truth image is the standard for benchmarking and an algorithm performance evaluation. It is often used to measure the deviation of our output from the actual result. We selected five images downloaded from Berkeley Segmentation Dataset to be tested with our proposed algorithm, Sobel, Prewitt, LoG, Roberts, and Kirsch methods. The five images' IDs were 12003 (starfish), 300091 (surfing by a man), 35010 (butterfly with complex background), 314016 (dolphin) and 242078 (outdoor folding umbrellas). Edge maps yielded from different methods will be compared with the ground truth edge map provided by the database. The edge detection methods were evaluated in several forms: the number of true positive, true negative edges detected, the accuracy of detection and F measure.
True positive (TP) is the number of edge pixels that are correctly detected. Meanwhile, true negative (TN) is the amount of non-edge pixels that are correctly identified. Let O be the output image while I be our grayscale input image, TP can be expressed as: While TN is the intersection of both complements of input and output images.
Accuracy measures the overall performance of the edge detection algorithms. Taking account for both TN and TP, the equation is illustrated as follow: The higher the accuracy achieved by an algorithm, the better the edge detector's performance to be expected. A low accuracy rate could be expected if the total of TP and TN edge and non-edge pixels are detected by the algorithm is small. F measure is a performance test that combines precision and recalls to compute the final score that is not lower than 0. The higher the F measure value, the better the predictive ability of a particular edge detection method. In an ideal case of edge detection, F-score would be 1. In reality, F-score that is nearer to 1 is considered to be having decent performance.

Sharpened Image Quality Test
The final edge map obtained by computation of maximum gradient magnitude, produced by the proposed four convolutional kernels with the input image, possibly contains negative pixel values. Normalization is carried out, in this case, to normalize the whole pixel values in the image ranging from 0 to 255, and thus the final pixel values of the edge map will be in positive values. Adding the normalized edge map to the original input image potentially increases the artifacts and noises of the output image. Therefore, we evaluate the sharpened image quality with a peak signal-to-noise ratio (PSNR) and structural similarity index (SSIM).
The PSNR indicates the ratio between the maximum possible pixel intensity value of the input image and the mean squares of the errors between the input and the sharpened image. A high PSNR value indicates good details preservation and noise resistance offered by the sharpening algorithm. Let Considering our input image has a size of M rows and N columns. Mean squared error, MSE can examine the changes of the sharpened image from its original input image and can be denoted as Abrupt changes, for instance, noise and artifacts addition could result in a higher MSE in other words, the sharpened image is severely degraded after the sharpening step. SSIM index is a predictive method to measure the similarity between sharpened images and the input image. Structural information in an image is the strong dependencies of the pixels that delineate the structure of objects in an image. SSIM examines the structural information degradation in the image. SSIM formula includes three comparison measurements which are luminance ( ), contrast ( ) and structure ( ). For a simpler representation, let = , ℎ = .
Luminance comparison, ( , ) = 2 + 1 2 + 2 + 1 (11) Contrast comparison, ( , ) =  (13) where , , , and represents the local means, standard deviations and also the cross-variance for both original input image and edge-enhanced image respectively. Moreover, 1 , 2 , 3 ∈ ℝ + are the regularization constants for the three comparisons above. The three comparisons are later combined as follow: where α, β and γ are the weights and equal to one in this case. Finally, SSIM can be written as A high SSIM value indicates that the final sharpened image and the original input image are quantitatively similar. In simple words, the addition of an edge map into our input image does not change the structures of the objects in the image.

Edge Detection Performance Test
A high accuracy edge detection rate indicates the successful classification of true edge pixels or true positives and true non-edge pixels or true negatives. From Table 2, the proposed method yielded the highest accuracy in matching the ground truth edge map with the detected edges. By applying a threshold ranging from 50 to 55 to remove the existing noises, the accuracy rates obtained in the starfish image were 0.8287, 0.9008 in surfing image, 0.7710 in butterfly image, 0.8121 for dolphin image, and 0.8207 for outdoor umbrellas image. Notably, the Kirsch method gave the highest F value yet lower accuracy in most cases. In other words, Kirsch managed to detect more TP edges but it failed to classify non-edge pixels.
Roberts maintained its accuracy in detecting edges while Sobel and Prewitt methods often miss approximate the edges in the images, as reported in [19]. Mini Kirsch kernel found the maximum edge magnitude in several predetermined directions by rotating a 4 x 4 kernel. Inherit from the compass feature as reported in Kirsch operator [31], the proposed method could delineate the boundaries of the sample images with high continuity edge pixels as shown in Figure 2.
In biomedical image processing, proper edge detection in medical images is crucial, typically for human organ recognition or cancer cell detection [41]. However, medical images are contaminated with speckle noises, low background illuminance and resolution which increase the difficulties in identifying the region of interest from nearby tissues [7]. The contribution of the proposed method in biomedical image processing was further discussed in parts 4.1.1 and 4.1.2.

Edge detection on Mammograms
A mammogram is an X-ray image of the breast captured for breast cancer detection. Breast cancer detection procedures can be divided into a few stages, namely region of interest extraction, identification of suspicious tissues and tissue classification [42]. A good edge detection algorithm is vital in the region of interest extraction stage which can result in good identification and segmentation [5] [1].
As can be seen, Figure 3 showed that the proposed method managed to detect the lump structure with high edge pixel continuity compared to other methods. Accurate edge detection could visually assist physicians in making decisions and classification.

Edge detection on aneurysms images
Aneurysms refer to abnormal arterial dilatation and weakening of an artery wall, that can cause rupture and life-threatening internal bleeding [25]. Therefore, early prediction of rupture is needed yet the local inhomogeneous contrast makes the edge detection becomes more challenging [43]. The canny method outperformed in tracking strong edge pixels compared to other gradient-based methods. Meanwhile, the second-order derivative failed to remove the noises and its amplification eventually deteriorated the image quality which could be seen in Figure 4-d. Our proposed method could identify the edges of vessel trees much better than the other methods. The resulting edge map clearly distinguished the vessel regions from the background.

Sharpening Image Quality Analysis
As can be seen in Figure 5 and Figure 6, the image quality difference between the original input image and the sharpened image was hard to be differentiated. Hence, we evaluated the sharpened image with PSNR and SSIM test. Adding an edge map onto the original map might cause noise amplification as well as introduced undesired artifacts which could greatly degrade the quality of the image [27]. Data collected in Table 3 reported that the proposed method was considerably competitive with unsharp masking and Laplacian of Gaussian filter. A high PSNR value indicates good details preservation while avoiding latent noise amplification [1]. Medical images consist of a massive amount of unwanted noises that increase the difficulty in retaining its algorithm precision [33]. Therefore, sharpened medical images like brain MRI, knee MRI and funduscopic image resulted in a lower PSNR value than another three tested images.
Inspired by Laplacian of Gaussian method [13], a light gray edge map was added onto the image for the sharpening process. However, the process potentially shifted the image histogram to be left-skewed. Biased histogram resulted in indistinctive deviation foreground and background identification [12]. Therefore, we applied linear contrast enhancement to recover the contrast of the output image to increase its visibility. The proposed method could obtain the highest SSIM value for funduscopic image and knee MRI scan, referring a piece of good structural information was preserved.

Edge Detection After Sharpening
In Figure 7, the edge detection of the image was conducted with the Canny method to examine the enhanced edge information done through our method. More window edges were detected after sharpened by the proposed method.
Diabetic retinopathy, caused by diabetes, could damage the blood vessels leading to vision loss [44]. Blood vessel tracking is essential to detect the changes in vessel pattern to find the abnormalities among the vessel. The existing gradient-based method and gaussian-based method are inadequate to delineate a good edge map to achieve the objective [45]. Having the funduscopic image sharpened with the proposed method ( Figure  8-c), more vanishing edges image could be detected as in Figure 8

Separating Regions with Strong Edges
In biomedical image processing, observed edges are important to offer a good segmentation for region-based methods, for instance, active contour [46] and region growing [47]. In Figure 9-(a to c), oversegmentation often occurs when the region of interest has homogeneous intensity distribution with neighbouring tissues. In region growing, a seed point is placed within an interested region. The region continues to grow by adding nearby similar pixels and iteratively merges the other region according to their homogeneity. Edge refers to the discontinuities in pixels intensity which is commonly used as stopping criteria in regionbased method [7]. The proposed edge sharpening framework contributed to image acutance improvement that can enhance the apparent quality while retaining the structural information. With sharpened edges, the regionbased method would stop expanding its region across over the clear boundaries that can be seen in Figure 9-(d to f). In short, the proposed kernel could function as a rotating gradient-based edge detector with a good sense of edge detection compared to other methods. The algorithm was further developed into a competitive edge map sharpening framework. However, the kernel was heavily dependent on noise existent as reported in Table 3. The sharpening frameworks possibly amplified the existing noises in medical images. We suggested that implements of smoothing filters at the pre-processing stage can overcome the claimed problem. Edgepreserving filters [17] such as anisotropic diffusion filter, bilateral filter and non-local mean filter were recommended. On the other hand, mean filter and median filter should be avoided in this case as it inclined to washout the edges which increased the difficulties in edge detection.

CONCLUSION
Edge detection aims to find the boundaries of objects in the image. Meanwhile, image sharpening is an initiative to improve its apparent quality without altering structures in the image. Existing edge detection methods detect fragmental edges where the discontinuity makes the further segmentation to be more challenging. Therefore, we proposed a four-directional mini Kirsch edge detection method that inherited the characteristics of the eight-directional Kirsch compass edge detector and is sufficient to detect edges from different directions. From the edge detection performance analysis, the proposed method outperformed in its accuracy in detecting true edge pixels and true non-edge pixels. Besides, it yielded a satisfactory result in the F measure which mainly focused on the effectiveness of true edge detection. Despite the ability of convincing edge detection by our proposed method, we also introduced the novel involvement of the sharpening method by adding the edge map produced by our methods onto the original image. The quality of the sharpened image was well preserved with its strength of noise removal and with its overall structures retained. However, our proposed method has drawback in processing medical images which are full of speckle and Rician noises. A threshold was not enough to remove the noises thus we suggested to add another smoothing process using edge-preserving filters such as anisotropic diffusion filter, non-local mean filter, or bilateral filter before edge detection. In a nutshell, the sharpened image with the proposed method managed to increase its acutance information, and therefore a better continuity edge map could be observed after the sharpening process.