我正在使用带有 OpenCV 2.2 的 Microsoft Visual Studio 2010 Ultimate,我正在尝试使用函数 CvAcc(img1,img2) 获取 2 张图像并将它们相加。
该代码是
#include <opencv/cv.h>
#include<opencv/cvaux.h>
#include<opencv/highgui.h>
#include<opencv/cxcore.h>
#include <stdio.h>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc_c.h>
#include <opencv/cv.h>
using namespace cv;
using namespace std;
void main()
{
CvMemStorage* storage = cvCreateMemStorage(0);
cvNamedWindow("Image", 1);
IplImage* sum= cvCreateImage( cvSize(640,480), 32, 1);
IplImage* mean= cvCreateImage( cvSize(640,480), 8, 1);
IplImage* img;
img= cvLoadImage("C:/Users/Admin/Desktop/Open CV Images/img1.jpg");
cvAcc( img, sum);
img= cvLoadImage("C:/Users/Admin/Desktop/Open CV Images/img2.jpg");
cvAcc( img, sum);
cvConvertScale( sum, mean, 1.0/2,0);
cvShowImage("Image",mean);
cvWaitKey(0);
cvDestroyWindow("Image");
}
但是会发生错误(未处理的异常),即
Unhandled exception at 0x000007fefdfc9e5d (KernelBase.dll) in tagroba.exe: Microsoft C++ exception: cv::Exception at memory location 0x002beef0..
所以有人可以帮我解决这个问题吗?