如何在javacv / opencv中进行canny边缘检测? [英] How to do canny edge detection in javacv/opencv?

查看:555
本文介绍了如何在javacv / opencv中进行canny边缘检测?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正致力于图像处理项目,我需要检测图像边缘。我想使用canny边缘检测来检测图像的线条,所以我在互联网上使用javacv搜索了关于canny边缘检测的内容,我发现了一些教程,提供了关于canny边缘检测技术的基本概念,但我无法找到任何样本关于此的代码。有人可以提供简单的样本边缘检测代码吗?

I'm currently working on image processing project and I need to detect edges from image. I thought to use canny edge detection for detect lines of the image, So i searched about canny edge detection using javacv on internet and I found some tutorials which gives the basic idea about canny edge detection technique but I could not be able to find any sample code regarding this. Please can someone provide simple sample edge detection code ?

如果你能为下面的图像提供代码示例,我们非常感谢。

It’s really appreciate if you can provide code example for following image.

推荐答案

对于精确边缘检测,您需要执行如下操作。

For canny edge detection you need to perform like following.

IplImage gray = ...

cvCvtColor(colored, gray, CV_RGB2GRAY); 
cvSmooth( gray, smooth, CV_BLUR, 9, 9, 2, 2);   
cvThreshold(gray,gray, 155, 255, CV_THRESH_BINARY);

cvCanny( gray, gray, lowThreshold, highThreshold, aperature_size );  

检查这个问答更多细节

这篇关于如何在javacv / opencv中进行canny边缘检测?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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