# Efficient Edge Detection Method for Focused Images
## 5 Experimental Results  
In this section, we present the experimental results of edge detection. In Figure 5, the tested benchmark images [38] are presented. These images were resized to \(256\times 256\) pixels to make the computations easier. However, the proposed algorithm can be applied to images of any size. To fix the optimal parameters used in the proposed method (i.e., the number of segments, the size of the area window, and the size of the mask window), a number of experiments were performed. We show them for a sample image \"Ladybird\". The edges detected by the proposed local k-Means algorithm for different sizes of the area window (i.e., subimage) are presented in Figure 6. In this example, the number of segments were fixed at \(k=3\). From these images, one can see that the best visual results one obtains for the size equal to \(32\times 32\) pixels. Smaller areas (especially \(8\times 8\)) cause the noise effect. So, for all our experiments, we fixed the area size as \(32\times 32\) pixels. Figure 4: The sample filter masks: (**a**) a point mask of size \(5\times 5\) pixels, used for i.e., Canny algorithm, (**b**) an area mask of size \(8\times 8\) pixels, with the area size of \(4\times 4\) pixels, used for the proposed local k-Means. The edges detected by the proposed algorithm for different numbers of segments \(k\) are shown in Figure 7. From these images, one can see that the best results are obtained for three or four segments. In further experiments, we use three segments. The final test was made to check the optimal size of the mask. Therefore, the edges detected by the proposed algorithm for different sizes of the masks are shown in Figure 8. The size of the area was fixed as \(32\times 32\) pixels. From these images, one can observe that the optimal results are obtained for the mask's size \(48\times 48\) or \(64\times 64\) pixels. Figure 5: The benchmark images used in the experiments. Figure 6: Edges detected by the local k-Means algorithm with different area (subimage) size. Figure 7: Edges detected by the local k-Means algorithm with different numbers of segments. From the experiments performed, one can conclude that the optimal size of the subimage and the optimal number of segments can be fixed globally for all tested images. However, in the case of the mask's size, we can observe that, depending on the image, the best results are obtained by the sizes oscillating somewhere between \(48\times 48\) and \(64\times 64\) pixels. However, fixing this parameter for all images give also good results. Usually, when we deal with edge detection methods, the noise resistance is tested. However, in our case, it can be skipped. The reasons are twofold. Firstly, we are interested in focused images. This kind of image is noise-free by definition. Secondly, even if we would like to consider noised images, there is a number of methods to remove noise from k-Means clustering efficiently, e.g., [39], that can be applied. Finally, we compared the proposed method to the state-of-the-art ones. The reference methods are Canny, wedgelets2 [19], and global k-Means. The Canny and k-Means algorithms are classical and work globally and pointwise (however, the latter method works in a more intelligent way than the former one). However, the wedgelets2-based method was proposed as the geometrical method that can be used for object detection or recognition. This method is local and is based on the local window mechanism. These reference algorithms were chosen as the best methods representing different approaches (i.e., pointwise, geometrical, and ML-based). We excluded CNN-based methods from the experiments since they need a huge training dataset and time-consuming training. In all the methods tested, the optimal parameters were fixed. In the Canny case, the thresholds were fixed as 100 and 150 as this is the best compromise between the lack of noise in the foreground and the accuracy of the background edges. In the case of wedgelets2, the second-order wedgelets were used.