How to do canny edge detection in javacv/opencv?

烂漫一生 提交于 2019-12-05 05:06:35

问题


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.


回答1:


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 );  

Check this Question and Answer for more detail



来源:https://stackoverflow.com/questions/12994612/how-to-do-canny-edge-detection-in-javacv-opencv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!