OpenCV - 如何提取边缘形成Canny函数的结果? [英] OpenCV - How to extract edges form result of Canny Function?

查看:175
本文介绍了OpenCV - 如何提取边缘形成Canny函数的结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OpenCV中使用Canny()函数,如下所示

  Mat detected_edges = GetImage ...; 
Canny(detected_edges,detected_edges,20,20 * 3,kernel_size);

我的问题是这个函数的结果只有一个黑白图像,



在OpenCV文档中写入

在输入图像图像中,并使用Canny算法将输出图边缘标记在
中。 threshold1和threshold2之间的最小值
用于边缘链接。
最大值用于查找初始的强边缘。


但我不知道如何提取线从结果图片中,有人可以帮助我。



UPDATE 我在下面测试的图片,此图片包括Canny函数的结果



>

解决方案

取决于您要检索的形状,




I'm using Canny() Function in OpenCV as below

Mat detected_edges = GetImage...;
Canny( detected_edges, detected_edges, 20, 20*3, kernel_size );

My problem is the result of this function only a black-white image, I want to get the set of edges that detected.

On OpenCV docs wrote

The function finds edges in the input image image and marks them in the output map edges using the Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The largest value is used to find initial segments of strong edges.

But I don't know how to extract lines from the result image, someone can help me.

UPDATE The image that I used to test below, this image include the result of Canny function

解决方案

depending on the shape you're trying to retrieve,

这篇关于OpenCV - 如何提取边缘形成Canny函数的结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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