[英]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.