码迷,mamicode.com
首页 > 其他好文 > 详细

cvCanny

时间:2014-08-14 11:02:08      阅读:366      评论:0      收藏:0      [点我收藏+]

标签:opencv cvcanny

核心函数:cvCanny

程序:

bubuko.com,布布扣

代码:

#include "cv.h"
#include "cxcore.h"
#include "highgui.h"
#include <iostream>
int canny(int argc,char** argv)
{
IplImage* src1=cvLoadImage("e:\\picture\\7.jpg",0);  //源图像和目的图像都必须为灰度图像
IplImage* src2=cvLoadImage("e:\\picture\\8.jpg",0);
IplImage* src3=cvLoadImage("e:\\picture\\4.jpg",0);
IplImage* dst1=cvCreateImage(cvGetSize(src1),8,1);
IplImage* dst2=cvCreateImage(cvGetSize(src2),8,1);
IplImage* dst3=cvCreateImage(cvGetSize(src3),8,1);
cvCanny(src1,dst1,50,125); //第三个和第四个参数分别为上下阀值,建议上下阀值的比为2:1到3:1
cvCanny(src2,dst2,50,125);
cvCanny(src3,dst3,50,125);
cvNamedWindow("src1");
cvNamedWindow("src2");
cvNamedWindow("src3");
cvNamedWindow("dst1");
cvNamedWindow("dst2");
cvNamedWindow("dst3");
cvShowImage("src1",src1);
cvShowImage("src2",src2);
cvShowImage("src3",src3);
cvShowImage("dst1",dst1);
cvShowImage("dst2",dst2);
cvShowImage("dst3",dst3);
cvWaitKey(0);
cvDestroyWindow("src1");
cvDestroyWindow("src2");
cvDestroyWindow("src3");
cvDestroyWindow("dst1");
cvDestroyWindow("dst2");
cvDestroyWindow("dst3");
cvReleaseImage(&src1);
cvReleaseImage(&src2);
cvReleaseImage(&src3);
cvReleaseImage(&dst1);
cvReleaseImage(&dst2);
cvReleaseImage(&dst3);
return 0;
}


本文出自 “flyclc” 博客,请务必保留此出处http://flyclc.blog.51cto.com/1385758/1539739

cvCanny,布布扣,bubuko.com

cvCanny

标签:opencv cvcanny

原文地址:http://flyclc.blog.51cto.com/1385758/1539739

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!