代码如下:
#include "stdafx.h"
#include "cv.h"
#include <highgui.h>
#include <cxcore.h>
IplImage *doPyrDown(IplImage *in,int filter=IPL_GAUSSIAN_5x5){
IplImage *out=cvCreateImage(cvSize(in->width*2,in->height*2),in->depth,in->nChannels);
cvPyrDown(in,out);
return (out);
};
int _tmain(int argc, _TCHAR* argv[])
{ IplImage *img=cvLoadImage("E:\\a.jpg");
cvNamedWindow("Example-in",CV_WINDOW_AUTOSIZE);
cvNamedWindow("Example-out");
cvShowImage("Example-in",img);
IplImage *out=doPyrDown(img,IPL_GAUSSIAN_5x5);
cvShowImage("Example-out",out);
cvWaitKey(0);
cvReleaseImage(&out);
cvDestroyWindow("Example-in");
cvDestroyWindow("Example-out");
return 0;
}
程序运行时,“return (out);”一行报错:Exe-3.exe 中的 0x000007fcb8e5811c 处有未经处理的异常: Microsoft C++ 异常: 内存位置 0x00fe5f10 处的 cv::Exception。
其实我的本意是想把图像放大…用DoPyrUp试过了,依旧调试不出来…
改过了,但是依旧在同样的地方报错嘤…用new声明了函数里的out也还是不行…肿么办T.T
追答应该是cvPyrDown报错了,首先看img显示的对不对,然后试着换其他图片,像bmp,png格式的,再试试灰阶或者黑白图像。
本回答被提问者采纳