if (dtype == -1 && dst.fixedType())
dtype = dst.depth();
- if (!dst.fixedType() || dtype == dst.depth())
+ dtype = CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), src1.channels());
+
+ if (!dst.fixedType() || dtype == dst.type())
{
+ dst.create(src1.size(), dtype);
+
if (dtype == CV_16S)
{
Mat _dst = dst.getMat();
}
INSTANTIATE_TEST_CASE_P(Arithm, Mul1, testing::Values(Size(2, 2), Size(1, 1)));
+
+TEST(Subtract8u8u16s, EmptyOutputMat)
+{
+ cv::Mat src1 = cv::Mat::zeros(16, 16, CV_8UC1);
+ cv::Mat src2 = cv::Mat::zeros(16, 16, CV_8UC1);
+ cv::Mat dst;
+ cv::subtract(src1, src2, dst, cv::noArray(), CV_16S);
+ ASSERT_FALSE(dst.empty());
+ ASSERT_EQ(0, cv::countNonZero(dst));
+}