Fix min with empty matrices.

Fixes https://github.com/opencv/opencv/issues/29739
This commit is contained in:
Vincent Rabaud
2026-08-20 23:41:57 +02:00
parent 4a3689d026
commit c818ba8a81
3 changed files with 10 additions and 5 deletions

View File

@@ -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,

View File

@@ -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()

View File

@@ -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