简体   繁体   English

cv2.Canny 中的低阈值参数和高阈值参数有什么区别?

[英]What is the difference between low threshold parameter and high threshold parameter in cv2.Canny?

I want to apply Canny function to the image to detect the edges.我想将 Canny function 应用于图像以检测边缘。

This is how the function looks like:这就是 function 的样子:

cv2.Canny(image, threshold1, threshold2, apertureSize, L2gradient)

threshold1: It is the High threshold value of intensity gradient. threshold1:强度梯度的高阈值。

threshold2: It is the Low threshold value of intensity gradient. threshold2:强度梯度的低阈值。

I do not understand the difference between threshold1 and threshold2.我不明白 threshold1 和 threshold2 之间的区别。 I searched it online but I am still not able to understand it.我在网上搜索了它,但我仍然无法理解它。

Here is my original image:这是我的原始图像: 在此处输入图像描述

An example with low threshold1 and high threshold2:具有低阈值 1 和高阈值 2 的示例:

canny_low_threshold1 = cv2.Canny(blurred_image, 10, 100)
cv2.imshow("low_threshold1", canny_low_threshold)

在此处输入图像描述 Here is the exact opposite:这是完全相反的:

canny_high_threshold1 = cv2.Canny(blurred_image, 100, 10 )
cv2.imshow("high_threshold1", canny_high_threshold1)

在此处输入图像描述

They produce exactly the same output.他们生产完全相同的 output。 Could somebody please explain me the difference?有人可以解释一下区别吗?

For example, We have points A,B, C.If point A is higher than the maxVAl it is considered as an edge, if B is inbetween maxVal and minVal, and the point B is not connected to the pointA which is above the maxVal it is not observed as an edge.例如,我们有点A,B,C。如果点A高于maxVal,则认为是一条边,如果B在maxVal和minVal之间,并且点B不连接到高于maxVal的点A它没有被观察为边缘。 If point C is below minVal it is not considered as an edge at all.如果点 C 低于 minVal,则根本不被视为边缘。 The maxVal and minVal tend to separate potential edges from false edges maxVal 和 minVal 倾向于将潜在边缘与错误边缘分开

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 cv2.threshold() 中的哪些设置可以对该图像进行阈值处理? - What settings in cv2.threshold() to threshold this image? cv2.Canny() 是否执行高斯模糊? - Does cv2.Canny() perform a Gaussian blur? 在 Python 中使用低阈值和高阈值对图像进行阈值处理 - Thresholding an image with a low and high threshold in Python sklearn中是否有设置惩罚阈值的参数? - Is there a parameter to set a penalty threshold in sklearn? scipy的fcluster / fclusterdata中的t(阈值)参数是什么? - What is the t (threshold) parameter in scipy's fcluster / fclusterdata? 运行 cv2.Canny() 时 Emacs 中的 python opencv 错误 - python opencv error in Emacs when running cv2.Canny() 如果 NaN 的数量等于阈值参数,则删除列 - Drop columns if number of NaNs equals the threshold parameter 日期之间的任何差异都超过阈值 - Any Difference Between Dates Exceeds a Threshold 变量和参数有什么区别 - What is the difference between a variable and a parameter 来自 openCV 的 Canny 算法:阈值的真正含义是什么,为什么它们会高于数组的值? - Canny algorithm from openCV: What does the Threshold values really mean and why can they be higher than the values of the array?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM