mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 21:20:18 +08:00
Merge pull request #19811 from alalek:issue_19599
This commit is contained in:
commit
f82303d614
@ -623,7 +623,8 @@ static void arithm_op(InputArray _src1, InputArray _src2, OutputArray _dst,
|
||||
(kind1 == _InputArray::MATX && (sz1 == Size(1,4) || sz1 == Size(1,1))) ||
|
||||
(kind2 == _InputArray::MATX && (sz2 == Size(1,4) || sz2 == Size(1,1))) )
|
||||
{
|
||||
if( checkScalar(*psrc1, type2, kind1, kind2) )
|
||||
if ((type1 == CV_64F && (sz1.height == 1 || sz1.height == 4)) &&
|
||||
checkScalar(*psrc1, type2, kind1, kind2))
|
||||
{
|
||||
// src1 is a scalar; swap it with src2
|
||||
swap(psrc1, psrc2);
|
||||
|
@ -1551,4 +1551,14 @@ TEST(Core_MatExpr, empty_check_15760)
|
||||
EXPECT_THROW(Mat c = Mat().cross(Mat()), cv::Exception);
|
||||
}
|
||||
|
||||
TEST(Core_Arithm, scalar_handling_19599) // https://github.com/opencv/opencv/issues/19599 (OpenCV 4.x+ only)
|
||||
{
|
||||
Mat a(1, 1, CV_32F, Scalar::all(1));
|
||||
Mat b(4, 1, CV_64F, Scalar::all(1)); // MatExpr may convert Scalar to Mat
|
||||
Mat c;
|
||||
EXPECT_NO_THROW(cv::multiply(a, b, c));
|
||||
EXPECT_EQ(1, c.cols);
|
||||
EXPECT_EQ(1, c.rows);
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
Loading…
Reference in New Issue
Block a user