1、源代码:
IplImage* image_src; //定义IplImage*变量
IplImage *image = cvLoadImage(“test.jpg”); //加载一幅图片
int width = image->width;
int height = image->height;
if(width < 1 || height < 1){
cout<<" width = "<<width<<", height = "<<height<<endl;
cvReleaseImage(&image_src);
cvReleaseImage(&image);
return -1;
}
image_src = cvCloneImage(image);
此段代码编译无误可以通过,但在运行过程中,程序会在cvReleaseImage(&image_src);处退出,且无任何错误提示。
2、修改后代码:
IplImage *image = cvLoadImage(“test.jpg”); //加载一幅图片
int width = image->width;
int height = image->height;
if(width < 1 || height < 1){
cout<<" width = "<<width<<", height = "<<height<<endl;
cvReleaseImage(&image);
return -1;
}
IplImage *image_src = cvCloneImage(image);
运行通过。
3、2017.01.06补充:
在1、源