diff --git a/modules/core/src/matrix_wrap.cpp b/modules/core/src/matrix_wrap.cpp index 6999264bc6..e7362196c5 100644 --- a/modules/core/src/matrix_wrap.cpp +++ b/modules/core/src/matrix_wrap.cpp @@ -1953,8 +1953,7 @@ Mat _OutputArray::reinterpret(int mtype) const void _OutputArray::createSameSize(const _InputArray& arr, int mtype) const { - int arrsz[CV_MAX_DIM], d = arr.sizend(arrsz); - create(d, arrsz, mtype); + create(arr.shape(), mtype); } void _OutputArray::fit(int d, const int* sizes, int mtype, int i, diff --git a/modules/core/src/umatrix.cpp b/modules/core/src/umatrix.cpp index 4b78cbda0a..010e60409a 100644 --- a/modules/core/src/umatrix.cpp +++ b/modules/core/src/umatrix.cpp @@ -370,9 +370,7 @@ void UMat::create(Size _sz, int _type, UMatUsageFlags _usageFlags) void UMat::createSameSize(InputArray arr, int _type, UMatUsageFlags _usageFlags) { - int arr_size[CV_MAX_DIM]; - int ndims = arr.sizend(arr_size); - create(ndims, arr_size, _type, _usageFlags); + create(arr.shape(), _type, _usageFlags); } void UMat::addref() diff --git a/modules/core/test/test_arithm.cpp b/modules/core/test/test_arithm.cpp index 74f24c8799..8b7a9eace7 100644 --- a/modules/core/test/test_arithm.cpp +++ b/modules/core/test/test_arithm.cpp @@ -4275,4 +4275,12 @@ TEST(Core_Arithm, DISABLED_mul_overflow_28557) } } + +TEST(Core_Arithm, min_empty) +{ + cv::Mat A, B, C; + cv::max(A,B,C); + EXPECT_TRUE(C.empty()); +} + }} // namespace