- #include "opencv/cv.h"
- #include "opencv/highgui.h"
- int main(int argc,char** argv)
- {
- IplImage* in = cvLoadImage(argv[1]);//载入图像
- cvNamedWindow("IN",1);
- cvShowImage( "IN", in);
- double lowThresh = 10;
- double highThresh = 100;
- double aperture = 3;
- /* if(in->nChannels != 1) {
- printf("It's not gray scale images!\n");
- return 0;
- } //Canny only handles gray scale images*/
- IplImage* out = cvCreateImage(
- cvGetSize(in),
- IPL_DEPTH_8U,
- 1
- );
- cvCanny( in, out, lowThresh, highThresh, aperture );
- cvNamedWindow("OUT",1);
- cvShowImage( "OUT", out );
- cvWaitKey(0);
- cvReleaseImage(&out);
- cvReleaseImage(&in);
- cvDestroyWindow("IN");
- cvDestroyWindow("OUT");
- return 0;
- }
- #include "opencv/cv.h"
- #include "opencv/highgui.h"
- int main(int argc,char** argv)
- {
- IplImage* in = cvLoadImage(argv[1]);//载入图像
- cvNamedWindow("IN",1);
- cvShowImage( "IN", in);
- double lowThresh = 10;
- double highThresh = 100;
- double aperture = 3;
- /* if(in->nChannels != 1) {
- printf("It's not gray scale images!\n");
- return 0;
- } //Canny only handles gray scale images*/
- IplImage* out = cvCreateImage(
- cvGetSize(in),
- IPL_DEPTH_8U,
- 1
- );
- cvCanny( in, out, lowThresh, highThresh, aperture );
- cvNamedWindow("OUT",1);
- cvShowImage( "OUT", out );
- cvWaitKey(0);
- cvReleaseImage(&out);
- cvReleaseImage(&in);
- cvDestroyWindow("IN");
- cvDestroyWindow("OUT");
- return 0;
- }