【OpenCV学习】边缘检测

作者:gnuhpc
出处:http://www.cnblogs.com/gnuhpc/

#include "cv.h"
#include "cxcore.h"
#include "highgui.h"

int main(int argc, char **argv)
{
IplImage *pImg =NULL;
IplImage *pCannyImg =NULL;

if((argc == 2)&&(pImg = cvLoadImage(argv[1],0))!=0)
{
pCannyImg =cvCreateImage(cvGetSize(pImg),IPL_DEPTH_8U,1);//申请空间
cvCanny(pImg,pCannyImg,50,150,3);//边缘检测
cvNamedWindow("canny",1);
cvShowImage("canny",pCannyImg);
cvSaveImage("lenabianyuan.jpg",pCannyImg);
cvWaitKey(0);
cvReleaseImage(&pImg);
cvReleaseImage(&pCannyImg);
return 0;
}
return -1;
}
posted @ 2012-06-28 21:48  gnuhpc  阅读(751)  评论(0编辑  收藏  举报