*2.2. Canny's Operator*

Canny's operator (Canny boundary detector, Canny algorithm) is a computer vision detection operator in the field of computer vision. It was developed in 1986 by John F. Canny and uses a multistep algorithm to detect a wide range of boundaries in images [16,29]. Canny said that this filter could be well approximated by the first Gaussian derivative. Kenny introduced the concept of non-maximum suppression, which means that pixels of boundaries are declared pixels in which the local maximum of the gradient is reached in the direction of the gradient vector.

• Good detection (Kenny interpreted this property as increasing the signal-to-noise ratio);

	- A single response to one edge.

•

From these criteria, the target function of error cost was then built, the minimization of which is the "optimal" linear operator for convolution with images.

The boundary detector algorithm is not limited to calculating the gradient of the smoothed image. Only the maximum points of the image gradient remain in the border contour, and the maximum points lying near the border are removed. It also uses information about the direction of the border in order to remove the points right next to the border and not to break the border itself near the local gradient maxima. Then, with the help of two thresholds, weak borders are removed. The fragment of the border is processed as a whole. If the value of the gradient somewhere on the observed fragment exceeds the upper threshold; this fragment also remains on the "permissible" edge and in places where the value of the gradient falls below this threshold, until it falls below the lower threshold. If there is no point on the whole fragment with a value greater than the upper threshold, it is deleted. This hysteresis reduces the number of breaks in the original edges. The inclusion of noise attenuation in Kenny's algorithm increases the stability of the results on the one hand and, on the other hand, increases computational costs and leads to distortion and even loss of boundary details. For example, this algorithm rounds the corners of objects and destroys boundaries at connection points.

The main stages of Canny's algorithm are:

Smoothing: blurred images to remove noise. Canny's operator uses a filter that may be close to the first Gaussian derivative σ = 1.4:


Search for gradients: borders are marked where the image gradient becomes maximum. They can have different directions, so Canny's algorithm uses four filters to detect horizontal, vertical, and diagonal edges in a blurred image. At this stage, Formulas (2) and (3) are used.

The angle of the direction of the gradient vector [30] is rounded and can take the following values: 0, 45, 90, and 135 (see Figure 1).

**Figure 1.** Gradient direction.

Suppression of non-maxima.

Only local maxima are marked as edges.

Double threshold filtering: potential limits are determined by thresholds.

Trace the area of ambiguity. The final limits are determined by suppressing all edges that are not related to certain (strong) limits.

Before using the detector, the image is usually converted to grayscale to reduce computational costs. This stage is typical of many image-processing methods.
