Ask Your Question
0

accumulateWeighted problems

asked 2015-06-10 04:10:34 -0600

Crashz83 gravatar image

Hello, excuse me for my bad english. I dev on QT and Ubuntu and i have a problem with accumulateWeighted between two images. My program displays images (1 per second) and calculates the difference between each image.

The problem is that I really do not find many OpenCV doc about this problem ...

My code :

Mat ImgDiffT0;
Mat Acc;

ImgDiffT0 = imread("mDiffT0.bmp", CV_LOAD_IMAGE_GRAYSCALE);

Acc = imread("mDiffT1.bmp", CV_LOAD_IMAGE_GRAYSCALE);

accumulateWeighted(ImgDiffT0, Acc, 0.5);

And the error during the execution is :

OpenCV Error: Assertion failed (func != 0) in accumulateWeighted, file /tmp/OpenCV-2.4.3/modules/imgproc/src/accum.cpp, line 435terminate called after throwing an instance of 'cv::Exception' what(): /tmp/OpenCV-2.4.3/modules/imgproc/src/accum.cpp:435: error: (-215) func != 0 in function accumulateWeighted

Thank you in advance for your help. :)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-06-10 06:25:03 -0600

LBerger gravatar image

updated 2015-06-10 06:43:38 -0600

Your result must be CV_32F or CV_64F

Mat ImgDiffT0;

ImgDiffT0 = imread("mDiffT0.bmp", CV_LOAD_IMAGE_GRAYSCALE);
Mat Acc(ImgDiffT0.rows, ImgDiffT0.cols,CV_32FC(ImgDiffT0.channels()));

accumulateWeighted(ImgDiffT0, Acc, 0.5);    
ImgDiffT0 = imread("mDiffT1.bmp", CV_LOAD_IMAGE_GRAYSCALE);
accumulateWeighted(ImgDiffT0, Acc, 0.5);
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-06-10 04:10:34 -0600

Seen: 3,276 times

Last updated: Jun 10 '15