首页 文章

断言失败

提问于
浏览
0

为什么我在使用 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;

这是错误

OpenCV错误:cvIntegral中的断言失败(sum.data == sum0.data && sqsum.data == sqsum0.data && tilted.data == tilted0.data),文件/build/buildd/opencv-2.3.1/modules /imgproc/src/sumpixels.cpp,第306行终止在抛出'cv :: Exception'的实例后调用what():/ build / buildd / opencv-2.3.1 / modules / imgproc / src / dumpixels.cpp:306 :错误:(-215)sum.data == sum0.data && sqsum.data == sqsum0.data && tilted.data == tilted0.data in function cvIntegral

1 回答

  • 2

    cvIntegral期望输出图像的类型为 CV_32FCV_64F . 此外,源图像和目标图像的通道数应相同 . 你应该这样做:

    image2 = cvCreateImage(cvSize(image->width+1,image->height+1),IPL_DEPTH_32F,image->nChannels);
    

相关问题