作者: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; }