opencv程序中出错:输入参数的大小不匹配
我尝试用OpenCV比较C语言中的两个图像。我尝试了以下代码:opencv程序中出错:输入参数的大小不匹配,c,opencv,C,Opencv,我尝试用OpenCV比较C语言中的两个图像。我尝试了以下代码: cv::Mat diff; cv::absdiff(src,dst,diff); cv::Mat image; cv::cvtColor(diff,image,CV_BGR2GRAY); if (CountNonZero(image)==0) printf("welcome you are autorised"); else printf("Sorry you are not welcome"); return 0; } 这是
cv::Mat diff;
cv::absdiff(src,dst,diff);
cv::Mat image;
cv::cvtColor(diff,image,CV_BGR2GRAY);
if (CountNonZero(image)==0)
printf("welcome you are autorised");
else
printf("Sorry you are not welcome");
return 0;
}
这是我在运行程序时遇到的错误:
OpenCV Error: Sizes of input arguments do not match (The operation is
neither 'array op array' (where arrays have the same size and the same
number of channels), nor 'array op scalar', nor 'scalar op array') in
arithm_op, file /build/opencv-ys8xiq/opencv-
2.4.9.1+dfsg/modules/core/src/arithm.cpp, line 1287
terminate called after throwing an instance of 'cv::Exception'
what(): /build/opencv-ys8xiq/opencv-
2.4.9.1+dfsg/modules/core/src/arithm.cpp:1287: error: (-209) The operation
is neither 'array op array' (where arrays have the same size and the same
number of channels), nor 'array op scalar', nor 'scalar op array' in
function arithm_op
Aborted (core dumped)
有人能帮我吗?cv::absdiff输入应具有相同的大小和通道。确保(src、dst)具有相同的大小和通道。Thnx I将尝试解决此问题。