Edge detection comparative analysis using Roberts, Sobel, Prewitt, and Canny methods

– Edge identification in a digital image is overgrowing in line with advances in computer technology for image processing. Edge detection becomes vital in recognizing the object of an image because the edge of the object in the image contains critical information. The information obtained can be either the size or shape of the object in the image, so the edge quality must be good so that the information contained in it is not lost. This study uses edge detection with the Roberts, Sobel, Prewitt, and Canny methods. The assessment method uses visual analysis, PSNR, Histogram, and Contrast. The study shows that the calculation of PSNR on the Roberts method has the highest value, with an average of 44.19 dB. Sobel, Prewitt, and Canny operators have PSNR values above 30 dB to classify it as a good image. The histogram value with the highest value is the Sobel operator, with an average histogram value of 22.06. In contrast, the highest contrast value is the Canny operator has an average contrast value of 5.08. The Roberts and Canny operators have the best image quality.


I. INTRODUCTION
Developing technology is now increasingly rapid, one of which is technology and applications in digital images [1].The image is a picture of the object and can be taken with a telephone camera that produces images precisely according to the object's state [2].Image is also included as one of the multimedia components that play an essential role as a form of visual information [3].
Image processing becomes an important part that underlies various applications, such as pattern recognition.Image processing manipulates images to have better quality to be easily interpreted by humans or machines [4].Digital image processing by computer has several formats, including the Joint Photographic Experts Group (JPEG) [5].
Edges are treated as essential features of an image to estimate the properties and structure of an object.Edges are usually identified at the boundary line between two different regions in an image.Edge detection in an image is a process that produces edges of objects in the image so that the boundary information of the image can be highlighted [6].The purpose of edge detection is to improve the details of blurred images, which occur due to errors or the effects of the image acquisition process [7].Edge contains crucial information; the information obtained can be in size or shape that is suitable for object identification [8].Quality on edge detection in the image must be good so that its information is not lost.Edge detection methods are divided into several types: the Roberts operator, Sobel operator, Prewitt operator, and Canny operator [9].These four methods have their respective advantages and disadvantages of edge detection.
Previous studies related to the theme of this study were conducted by Suryantara [10] using the Sobel edge method, and Prewitt.It concluded that both methods could detect objects well, but in this study, visual quality assessment was used.Wibowo et al. [11] conducted the analysis of the Sobel edge detection method and Laplacian of Gaussian (LOG), concluded that the LOG method could produce better edges than Sobel.This study used visual quality assessment and used Canny's reference.Other similar studies in [12]- [14].These studies have similarities, namely comparing the Canny and Prewitt edge detection methods using dimension parameters [13] and PSNR [12], [14].
This study compares and analyzes the four edge detection methods, namely the Roberts operator, Sobel operator, Prewitt operator, and Canny operator using MATLAB programming.Image quality assessment using PSNR parameters, histogram values, and contrast.This research is needed because of the need for other quality assessment parameters that have not been used in the previous assessment.

II. RESEARCH METHODS
The stages carried out in this study consisted of several steps, from inputting the original image, processing with edge detection methods to the results of a comparison of all edge detection methods.Figure 1 shows the flowchart of the testing phases carried out in this study.The first step starts with inputting the original image, then converting the RGB image to grayscale.Grayscale images that have been obtained will be processed using the four edge detection methods so that the results obtained from each edge detection.All edge detection results are compared to determine each quality using PSNR calculation parameters, histogram values, and contrast values.The following process is to input all edge detection results and then compare each detected quality using PSNR calculation parameters, histogram values, and contrast values.The four edge detection methods used in this study are as follows.

A. Operator Roberts
The Roberts operator is an operator that uses two 2x2 kernels (Gx and Gy) with gradient magnitude (G) as in ( 1) and ( 2).Operator * represents 2-dimensional convolution operation and I represents image.Because Robert's operator only uses a 2x2 convolution mask, Robert's operator is very sensitive to noise [15], [16].

B. Operator Sobel
The Sobel operator is an operator that uses two 3x3 kernels and a gradient magnitude (G) as in ( 3) and ( 4) [12].The advantage of this Sobel method is the ability to reduce noise before performing edge detection calculations.

C. Operator Prewitt
The Prewitt operator is an operator that uses two 3x3 kernels (Gx and Gy) and gradient magnitude (G) as in ( 5) and ( 6) [13].This operator is more sensitive to horizontal and vertical edges than diagonal edges.

D. Operator Canny
The Canny operator is an operator that uses two 3x3 kernels and a gradient magnitude (G) as in (7) and ( 8) [17].Canny edge detection can detect edges with a minimum error rate.

E. Image Quality Assessment
Objective measurements are intended to analyze image quality without human involvement.Several measurement methods have been used in research to compare the differences between the original image and the compressed image.Measurement methods such as Peak Signal Noise Ratio (PSNR) are used to measure the quality of the compression method on Roberts, Sobel, Prewitt, and Canny.PSNR represents the ratio between the maximum value of the measured bit depth image (8-bit image, 255) and the amount of noise that affects the maximum signal.The magnitude is represented by the value of MSE (Mean Square Error) [18].The higher the PSNR value, the better the quality of the compressed or reconstructed image.Eq. ( 9) is used to calculate PSNR [19].

III. RESULTS AND DISCUSSION
The photos used in this analysis are three photos with JPEG extension obtained from pexels.com with 4K quality.The analysis was done by inputting the four images into MATLAB, which the program had prepared to detect edges by the four methods in the form of operators Roberts, Sobel, and Canny.Figure 2 shows the original images used as research material.It shows the three-car photo materials used for the study.The photos were processed using the four edge detection methods and compared the quality of the detection results.

A. First image detection
The first image is the first photo in the form of a car photo.Figure 3 shows four edge detection results using the first photo material and displays the results of edge detection on the first material using the four methods.If we pay attention to visual analysis, some operators show good edge detection, as Prewitt and Sobel's operators have thick line edges.Meanwhile, for objective analysis using PNSR, histogram, and contrast parameters can be seen in Table 1.

B. Second image detection
The second image is the second photo (b) in the form of a tree photo.Figure 4 shows the four edge detection results using the first photo material and displays the results of edge detection on the second photographic material using the fourth method.If seen from visual observation, it can be seen that the Prewitt and Sobel operators have thick line edges when compared to other operators.The objective analysis using PNSR parameters, histogram, and contrast can be seen in Table 2.

C. Third image detection
The third image detection is for the third photo (c) in the form of a city photo.Figure 5 shows the four edge detection results using the third photo material.Several operators show good edge detection as in edge detection using the Sobel and Prewitt operators when viewed with visual analysis.The Sobel and Prewitt operators can show a margin, but the resulting line is not as bright as the other operator.Meanwhile, for objective analysis using PNSR parameters, histogram, and contrast can be seen in Table 3.
An objective quality assessment is better than a visual assessment conducted in previous studies because each individual has their own opinion.Therefore an objective assessment is needed to measure the edge detection quality [14].higher the PSNR value, the better the image processing results [20].Image quality is good if the PSNR value is above 30 dB [21], [22].Table 4 represents the PSNR value for each edge detection result.PSNR value data was obtained using MATLAB tools.
The highest PSNR values are Roberts and Prewitt operators with an average value of 44.19 dB and 39.00 dB.These operators are still relatively good because they are still above 30 dB [14].From the two PSNR calculations, it has been concluded that the Roberts method has the best PSNR value compared to the others, while the Sobel, Prewitt, and Canny operators have PSNR values above 30 dB so that they are categorized as good.Operator Robert has a high PSNR value because this operator uses a 2x2 matrix window.This operator performs calculations by taking the diagonal direction to calculate the gradient value and emphasizes checking in both diagonal directions rather than the horizontal or vertical direction.The difference lies on the sides oblique object will be detected better [23].These results show a difference with previous studies that examined the PSNR comparison using the Prewitt, Kirsch, and Canny edge methods, which concluded that the Prewitt method had the highest value, but if compared with the Roberts operator, the PSNR value on the Prewitt was still below the Roberts operator [14].
The following comparison test uses the histogram value, as presented in Table 5.It shows the histogram value of each edge detection that has been tested on the research material.The histogram value data is obtained using MATLAB tools.The three research materials showed the highest histogram values on Sobel operators with an average histogram value of 22.06, while Roberts operators owned the lowest histogram values with an average value of 5.62.Results show the same as previous studies comparing Sobel, Robert, and Prewitt edge detection.This study concludes that the Sobel operator has the highest histogram value from other operators [24].
Table 6 represents the contrast values possessed by each edge detection tested on the research material.The contrast value data is obtained using MATLAB tools.The contrast values that show the highest results are Canny operators with an average contrast value of 5.08, while the lowest contrast values in the contrast value diagram are Roberts operators with an average value of 0.26.Canny shows that edge detection can detect edges with a minimum error rate.

IV. CONCLUSION
The image quality assessment on the edge detection method showed that the PSNR of the Roberts method had the highest value, with an average of 44.19 dB.Other operators also have an average PSNR value of above 30 dB, classified as a good image.The histogram value with the highest value is on the Sobel operator, with an average histogram value of 22.06, while the contrast analysis shows that the Canny operator has an average contrast value of 5.08, which is the highest compared to the others.The edge detection results on the Roberts and Canny operators have good quality without corrupted image information.

Figure 4 .
Figure 4. Detection of the edge of the second photo

Table 1 .
PSNR, histogram, and contrast values of first detection

Table 2 .
PSNR, histogram, and contrast values of second detection

Table 3 .
PSNR, histogram, and contrast values of third photo edge detection

Table 4 .
PSNR values for all edge detection methods

Table 5 .
Histogram values for all edge detection methods

Table 6 .
Contrast values for all edge detection methods