Vadim Pisarevsky 8 years ago
parent b59df66709
commit 4eda8efd42
  1. 2
      modules/core/src/arithm.cpp
  2. 10
      modules/core/test/test_arithm.cpp

@ -1276,7 +1276,7 @@ void cv::compare(InputArray _src1, InputArray _src2, OutputArray _dst, int op)
src1 = src1.reshape(1); src2 = src2.reshape(1);
Mat dst = _dst.getMat().reshape(1);
size_t esz = src1.elemSize();
size_t esz = std::max(src1.elemSize(), (size_t)1);
size_t blocksize0 = (size_t)(BLOCK_SIZE + esz-1)/esz;
BinaryFuncC func = getCmpFunc(depth1);

@ -1912,3 +1912,13 @@ TEST(Subtract, scalarc4_matc4)
ASSERT_EQ(0, cv::norm(cv::Mat(5, 5, CV_8UC4, cv::Scalar::all(250)), destImage, cv::NORM_INF));
}
TEST(Compare, empty)
{
cv::Mat temp, dst1, dst2;
cv::compare(temp, temp, dst1, cv::CMP_EQ);
dst2 = temp > 5;
EXPECT_TRUE(dst1.empty());
EXPECT_TRUE(dst2.empty());
}

Loading…
Cancel
Save