int main()
{
cvNamedWindow("ContrastBin", 1);
cvNamedWindow("PreContrastBin",1);
cvNamedWindow("GrayImage",1);
CvCapture *pCapture = cvCreateFileCapture("D:/projects1/DSPAlgs/datasrc/xinwenlianbo_clip1.wmv");
IplImage *pFrame = cvQueryFrame(pCapture);
IplImage *pGrayImage = cvCreateImage(cvGetSize(pFrame),IPL_DEPTH_8U,1);
return 0;
}
在debug模式下,编译通过,运行中断在cvCreateFileCapture那一行,显示内存泄露。
可能原因:
1.文件路径错误;
2.opencv的库有问题;
经检查,文件路径正确。库文件有误:
原来:
opencv_core220.lib
opencv_highgui220.lib
opencv_video220.lib
opencv_ml220.lib
opencv_legacy220.lib
opencv_imgproc220.lib
改正:
opencv_core220d.lib
opencv_highgui220d.lib
opencv_video220d.lib
opencv_ml220d.lib
opencv_legacy220d.lib
opencv_imgproc220d.lib
理由:不加d则为release模式下的库,加d为debug模式下的库文件。