1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #26444 from dkurt:fix_empty_mat_assert

Fix empty mat debug assertion #26444

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Dmitry Kurtaev
2024-11-11 22:54:57 +03:00
committed by GitHub
parent e83a7fef9f
commit c7a21dc5bf
2 changed files with 7 additions and 1 deletions
+3
View File
@@ -152,7 +152,10 @@ void read(const FileNode& node, Mat& m, const Mat& default_mat)
size_t nelems = data_node.size();
if (nelems == 0)
{
m = Mat();
return;
}
CV_Assert(nelems == m.total()*m.channels());
data_node.readRaw(dt, (uchar*)m.ptr(), m.total()*m.elemSize());
+4 -1
View File
@@ -2043,7 +2043,10 @@ void testExactMat(const Mat& src, const char* ext)
EXPECT_EQ(dst.empty(), srcIsEmpty);
EXPECT_EQ(src.dims, dst.dims);
EXPECT_EQ(src.size, dst.size);
EXPECT_EQ(cv::norm(src, dst, NORM_INF), 0.0);
if (!srcIsEmpty)
{
EXPECT_EQ(0.0, cv::norm(src, dst, NORM_INF));
}
}
typedef testing::TestWithParam<const char*> FileStorage_exact_type;