why do i keep receiving this error when i use cvIntegral()
if ((image = cvLoadImage(filename,1))==0){
return -1;//if there is something wrong exit with -1
}
image2 = cvCreateImage(cvSize(image->width++,image->height++),IPL_DEPTH_8U,1);
cvIntegral(image, image2, NULL,NULL);
cvReleaseImage(&image);//release image and exit
cvReleaseImage(&image2);//release image and exit
return 0;
this is the error
OpenCV Error: Assertion failed (sum.data == sum0.data && sqsum.data == sqsum0.data && tilted.data == tilted0.data) in cvIntegral, file /build/buildd/opencv-2.3.1/modules/imgproc/src/sumpixels.cpp, line 306 terminate called after throwing an instance of 'cv::Exception'
what(): /build/buildd/opencv-2.3.1/modules/imgproc/src/sumpixels.cpp:306: error: (-215) sum.data == sum0.data && sqsum.data == sqsum0.data && tilted.data == tilted0.data in function cvIntegral
cvIntegral
expects the output image to be of type CV_32F
or CV_64F
. Also, the number of channels for the source and destination images should be same. You should be doing this:
image2 = cvCreateImage(cvSize(image->width+1,image->height+1),IPL_DEPTH_32F,image->nChannels);