我将 cv::max
与未初始化的 Mat
对象一起使用,将未初始化的对象作为第一个参数传递时发生错误:
Mat a=Mat::ones(2,3, CV_32S);
Mat b;
max(a, b); // 1. OK
max(b, a); // 2. OpenCV Error
错误信息是:
OpenCV Error: Sizes of input arguments do not match (The operation is neither 'a rray op array' (where arrays have the same size and type), nor 'array op scalar' , nor 'scalar op array') in cv::binary_op, file C:\builds\2_4_PackSlave-win32-vc 11-shared\opencv\modules\core\src\arithm.cpp, line 1021
我的问题:理论上这两个调用不应该具有相同的效果吗?这是实现不完善还是我的误解?
编辑:
我在 win7 x64 上使用 vs2012 和 OpenCV2.4.8 x86
最佳答案
这是一个错误,但现在已修复。请看http://code.opencv.org/issues/3696#note-7用于说明错误已修复的评论。
注意:cv::min
也存在同样的问题。
关于c++ - opencv cv::max 行为意外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23661235/