# Efficient Edge Detection Method for Focused Images
## 5 Experimental Results
This method works in a geometrical way, so it can better detect background edges than the Canny method. In the case of the k-Means algorithm, the number of segments was used as 8 to find the compromise between the accuracy of the background and the foreground edges detection. To show the advantages of the proposed method we first show a simple artificial example from Figure 5f. In this example, one of the balls is in motion, so it is not focused. In Figure 9 the results of edge detection for this image by different methods are presented. From these results we can see that: (1) the Canny method cannot detect the object in motion properly (the edges are too smooth to be caught by this method); (2) the wedgelets2-based method produces the edges in a manner of small lines or curves, not necessarily connected;  
Figure 8: Edges detected by the local k-Means algorithm with a different number of segments (rows: \(k=3\), \(k=4\)) and different sizes of the mask (columns: \(32\times 32\), \(48\times 48\), \(64\times 64\), and \(96\times 96\) pixels). (3) the k-Means algorithm detects the shadows on the table and this cannot be avoided without significant degradation of the balls, it follows from its global working; (4) the proposed method seems to overcome all the drawbacks of the former methods. Indeed, it can detect smooth edges as well as sharp ones, it produces nearly continuous edges, and thanks to the locality, it avoids detecting unexisting edges like shadows. In Figure 10 the results of edge detection by different methods for natural still images are shown. From the presented results, one can see that the proposed local k-Means algorithm definitely works better than the reference algorithms. For this method, all edges are just edges, no matter how smooth they are. In the above comparisons, we have limited to the visual assessment of the edge detection accuracy. It follows from the fact that we compared here the methods from different classes of edge detection techniques. Each class has specific characteristics and needs a different approach in the objective evaluation of edge detection efficiency. This is because of the different edge definitions used. Let us note that in the case of pointwise methods, a detected edge is a pure set of points, whereas, in the case of geometrical methods, a detected edge is a segment of a line or curve. The second point is that when we deal with sharp edges, it is relatively easy to decide what is an edge and what is not. When introducing smooth edges, it is hard to clearly state whether we still deal with an edge or a texture, or something else. It depends on the application and the user's needs. However, to show that the introduction of the local k-Means really improves edge detection numerically, we present here the comparison of the image segmentation results between the original global k-Means algorithm and the proposed local use of it. As one can see from Table 1, the proposed method gives better-quality image segmentation in the Peak-Signal-to-Noise-Ratio (PSNR) sense. So, we can conclude that since the proposed method segments images more accurately than the k-Means algorithm, it also better represents the detected edges than the original method. \begin{table}
\begin{tabular}{c c c} \hline \hline
**PSNR** & **Global k-Means** & **Local k-Means** \\ \hline Ladybird & 30.26 & 31.68 \\ Monarch & 29.38 & 30.16 \\ Parrots & 29.13 & 30.81 \\ Bee & 29.13 & 30.2 \\ Soup & 28.84 & 30.12 \\ Balls & 31.40 & 35.51 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Image segmentation quality for global (original) and local (proposed) use of the k-Means algorithm in the means of PSNR. Figure 9: The results of edge detection by different methods: (**a**) Canny, (**b**) wedgelets2, (**c**) k-Means, (**d**) local k-Means (proposed). Let us note that the time complexity of the regular k-Means algorithm for an image of size \(N\times N\) pixels is \(O(kN^{2})\), where \(k\) is the number of segments.