首页 > 编程知识 正文

canny边缘检测算子,canny边缘检测的阈值

时间:2023-05-05 07:21:41 阅读:196447 作者:863

canny边缘检测算法

Canny edge detector is a multi-step algorithm to detect the edges for any input image. It involves below mentioned steps to be followed while detecting edges of an image.

Canny边缘检测器是一种多步算法,可检测任何输入图像的边缘。 它涉及检测图像边缘时要遵循的下述步骤。

1. Removal of noise in input image using Gausian filter.

1.使用bldbm滤波器消除输入图像中的噪声。

2. Computing the derivative of Gausian filter in order to calculate the gradient of image pixels to obtain magnitude along x and y dimension.

2.计算bldbm滤波器的导数,以便计算图像像素的梯度以获得沿x和y维度的幅度。

3. Considering a group of neighbours for any curve in direction perpendicular to given edge supress the non-max edge contributor pixel points.

3.考虑在垂直于给定边缘的方向上的任何曲线的一组邻居抑制非最大边缘贡献者像素点。

4. Lastly use the Hysteresis Thresholding method to preserve the pixels higher than gradient magnitude and neglect the ones lower than the low threshold value.

4.最后,使用滞后阈值方法来保留高于梯度幅度的像素,而忽略低于低阈值的像素。

Before deep diving into the steps below are the three conclusions that J.K Canny who derived the algorithm :

在深入研究以下步骤之前,请先得出算法的JK Canny的三个结论:

- Good Detection : The optimal detector must eliminate the possibility of getting false positives and false negatives.

- 良好的检测:最佳检测器必须消除出现假阳性和假阴性的可能性。

- Good Localisation : The detected edges must be as close to true edges.

- 良好的本地化:检测到的边缘必须尽可能接近真实边缘。

- Single Response Constraint : The detector must return one point only for each edge point.

- 单一响应约束:检测器必须仅对每个边缘点返回一个点。

Steps to followed during Canny Algorithm:

Canny算法期间要遵循的步骤:

Noise Removal or Image Smoothing:

去噪或图像平滑:

During the noise presence the pixel may not be close to being similar to its neigbouring pixels. This might result in obtaining improper or inappropriate detection of edges . In order to avoid the same we use the Gausian filter which is convolved with the image and removes the noise which prevents from getting the desired edges in output images.

在噪声存在期间,像素可能与其附近像素不太接近。 这可能导致获得不正确或不合适的边缘检测。 为了避免同样的情况,我们使用了bldbm滤波器,该滤波器与图像进行卷积,并去除了噪声,从而阻止了在输出图像中获得所需的边缘。

In the below example we are convolving gausian filter or kernel g(x,y) with image I. Here we wish to make sure that any given pixel must be alike its neighbouring pixels in output and so we use the matrix [1 1 1] in order to maintain the similarity between pixels and remove the noise.

在下面的示例中,我们将bldbm滤波器或核g(x,y)与图像I卷积在一起。在这里,我们希望确保任何给定的像素在输出中都必须与其相邻像素相似,因此我们使用矩阵[1 1 1]为了保持像素之间的相似度并消除噪点。

g(x,y)= Gausian Distribution

g(x,y)=bldbm分布

I = input image

I =输入图像

Derivative :

导数:

Calculate the derivative of filter w.r.t X and Y dimensions and convolve it with I to give the gradient magnitude along the dimensions. Also the direction of image can be calculated using the tangent of angle between the two dimensions.

计算滤波器X和Y尺寸的导数,并将其与I卷积,以得出沿尺寸的梯度幅度。 同样,可以使用两个维度之间的角度切线来计算图像方向。

The above convolution results in gradient vector which has magnitude and direction.

上述卷积导致具有大小和方向的梯度矢量。

Below is an example of Gausian Derivatives which finally contribute to edges in output images.

下面是bldbm导数的一个示例,它们最终有助于输出图像中的边缘。

Non Max Suppression

非最大抑制

Along an edge it is generally observed that the presence of few points make the visibility of edge more clearer. So we can neglect those edge points which don’t contribute more towards feature visibility. In order to achieve the same we use the Non Maximum Supression method . Here we kxdmf the points on the curve of edge where the magnitude is largest . This can be obtained by looking for a maximum along a slice normal to the curve.

通常沿着边缘观察到很少的点会使边缘的可见性更加清晰。 因此,我们可以忽略那些对特征可见性没有更多贡献的边缘点。 为了达到相同的目的,我们使用非最大压缩方法。 在这里,我们在边缘曲线上标记幅度最大的点。 这可以通过沿着垂直于曲线的切片寻找最大值来获得。

Consider the edge in below figure which has 3 edge points. Assume point (x,y) as point having largest gradient of edge. Check for the edge points in direction perpendicular to the edge and verify if their gradient is less than (x,y) . If the values are less than (x,y) gradient then we can suppress those non maxima points along the curve .

考虑下图中的边缘,该边缘具有3个边缘点。 假设点(x,y)为边缘的最大倾斜点。 检查垂直于边缘方向的边缘点,并验证它们的坡度是否小于(x,y)。 如果值小于(x,y)梯度,则我们可以抑制沿曲线的那些非最大值点。

Hysteresis Thresholding :

磁滞阈值:

If the gradient at a pixel is :

如果一个像素处的渐变为:

- Above “High” declare it as a ‘edge pixel’.

-在“高”上方,将其声明为“边缘像素”。

- Below “Low” declare it as a ‘non-edge pixel’.

-在“低”以下将其声明为“非边缘像素”。

- Between “low” and “high”

-在“低”和“高”之间

Consider its neighbours iteratively then declare it an “edge pixel” if its connected to an “edge pixel” or via pixels between “low” and “high”.

反复考虑其邻居,然后将其声明为“边缘像素”(如果其连接到“边缘像素”或通过“低”与“高”之间的像素连接)。

Thanks for reading !!

谢谢阅读 !!

Source Reference of Dr Mubarak Shah youtube videos.

Mubarak Shah博士youtube视频的来源参考。

翻译自: https://medium.com/analytics-vidhya/what-is-canny-edge-detection-algorithm-95defef75492

canny边缘检测算法

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。