简体   繁体   English

Android:如何使用OpenCV获得良好的Canny Edge检测阈值

[英]Android: how to get good high and low threshold for canny edge detection using opencv

i am using opencv library for image processing process in android. 我正在使用opencv库在android中进行图像处理。 The problem is when i use canny function for image. 问题是当我对图像使用canny函数时。 This is my code of using canny: 这是我使用canny的代码:

Imgproc.Canny(ImageMat, ImageMat, 0.4, 0.5);

i use low threshold 0.4 and 0.5 for high threshold, but the result for the image is not good. 我将低阈值0.4和0.5用于高阈值,但是图像的效果不佳。 I know i must change the low and high threshold to get the good result, but that must be different threshold for the other image too. 我知道我必须更改高低阈值才能获得良好的结果,但是对于其他图像,这也必须是不同的阈值。 How to get dynamic threshold for that canny process?? 如何获得该精明过程的动态阈值? My project is leaf recognition on android. 我的项目是Android上的叶子识别。 Sorry for my bad English language. 对不起,我的英语不好。

As far as I know, the only relatively automatic thresholding method may be Otsu operation. 据我所知,唯一相对自动的阈值化方法可能是Otsu操作。 You may put more effort on the channel selection and intensity mapping (usually non-linear) instead of thresholding trial. 您可以在通道选择和强度映射(通常是非线性的)上投入更多的精力,而不是尝试阈值化。 The aim of doing this is to maximize the difference between your object and background, which makes thresholding easier and more robust. 这样做的目的是使对象和背景之间的差异最大化,从而使阈值设置更容易且更可靠。 In order to achieve this purpose, you may need to check your leaf image database and get a rough idea of the intensity range of leaf and background. 为了达到这个目的,您可能需要检查叶子图像数据库并大致了解叶子和背景的强度范围。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM