Ask Your Question

Abd El Rahman's profile - activity

2013-05-11 14:22:59 -0600 asked a question “Unhandled exception (KernelBase.dll) ” error in CvAcc function using visual studio 2010 and opencv 2.2

I am using Microsoft Visual Studio 2010 Ultimate with OpenCV 2.2 and I am trying to use the function CvAcc(img1,img2) that takes 2 images and sum them.

The Code is

#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");

}

But an error occurs (Unhandled Exception) which is

     Unhandled exception at 0x000007fefdfc9e5d (KernelBase.dll) in tagroba.exe: Microsoft C++ exception: cv::Exception at memory location 0x002beef0..

So anyone can help me to solve this problem?