坎尼门槛的最佳价值 [英] Best value for threshold in Canny

查看:72
本文介绍了坎尼门槛的最佳价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张要检测其边缘的图像.我发现Canny已经使用了很多(我不知道我是否有比这更好的选择).我将值设置如下:

I have an image which I want to detect edges on that. I found Canny has been used a lot ( I don't know whether I have a better option than that). I have set the values as follow:

  Imgproc.Canny(img, img, 10, 100, 3,true)

我已经更改了阈值,但是我的图像没有看到太大的变化.任何人都可以向我解释是否有一种逻辑方法可以计算出阈值的数字(我的图像是灰度)

I've changed threshold values but don't see that much of a change in my image. Can anyone explain to me if there is a logical way to figure out numbers for threshold values (my image is gray scale)

谢谢...

推荐答案

我认为这应该视情况而定,如果您发布一些示例图像会很有用,但是无论如何我都会尝试回答.这是来自Opencv文档

I think this should be taken case by case, if you post some sample images would be useful, but I will try to answer anyways. Here is from Opencv Documents

Canny( detected_edges, detected_edges, lowThreshold, lowThreshold*ratio, kernel_size );
where the arguments are:

detected_edges: Source image, grayscale
detected_edges: Output of the detector (can be the same as the input)
lowThreshold: The value entered by the user moving the Trackbar
highThreshold: Set in the program as three times the lower threshold (following Canny’s recommendation)
kernel_size: We defined it to be 3 (the size of the Sobel kernel to be used internally)

通常对我有用的是highThreshold = 255 and lowThreshold = 255/3

这篇关于坎尼门槛的最佳价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆