在捕获两帧的差异时,我遇到了一个错误:
for(;;)
{
colourImage = cvQueryFrame(input);
diff=cvCloneImage(colourImage);
colourImage=cvQueryFrame(input);
cvAbsDiff(colourImage,diff,subtract);
cvCvtColor(subtract,greyImage,CV_RGB2GRAY);
cvShowImage("bg subtracted ",greyImage);
cvThreshold(greyImage, greyImage, 70, 255, CV_THRESH_BINARY);
cvDilate(greyImage, greyImage, 0, 18);
cvErode(greyImage, greyImage, 0, 10);
cvShowImage("final",greyImage);
cvWaitKey(33);
:
followed to contour extraction.
}
显示“最终”窗口后,程序终止而不进入轮廓部分。显示以下错误:
OpenCV Error: Assertion failed (src1.size == dst.size && src1.type() == dst.type()) in cvAbsDiff, file /home/ukri/src/OpenCV-2.4.2/modules/core/src/arithm.cpp, line 2786,terminate called after throwing an instance of 'cv::Exception' , what(): /home/ukri/src/OpenCV-2.4.2/modules/core/src/arithm.cpp:2786: error: (-215) src1.size == dst.size && src1.type() == dst.type() in function cvAbsDiff.AbortedOpenCV Error: Assertion failed (src1.size == dst.size && src1.type() == dst.type()) in cvAbsDiff, file /home/ukri/src/OpenCV-2.4.2/modules/core/src/arithm.cpp, line 2786terminate called after throwing an instance of 'cv::Exception' what(): /home/ukri/src/OpenCV-2.4.2/modules/core/src/arithm.cpp:2786: error: (-215) src1.size == dst.size && src1.type() == dst.type() in function cvAbsDiff.Aborted
我制作了 colourImage 、 diff 和减去相同的图像类型。错误仍然不断重复。