mirror of
https://github.com/opencv/opencv.git
synced 2026-09-12 05:11:04 -05:00
Merge pull request #29742 from varun-jaiswal17:test_cleanup
ptcloud , photo test suit cleanup - #29742 ## Test suite cleanup ### Given real assertions - **ptcloud** — `HugeSceneGrowthTest`: zero assertions, including a `// Reset check` comment followed by no check. - **ptcloud** — `PointCloud.SaveBadExtension`: passed an empty vertex set, so it exited at the empty-input guard and never reached the extension code it is named for. - **ptcloud** — new `PointCloud.SaveEmptyVertices`: covers the early-return branch the above was hitting by accident. ### Moved - **photo** — `Photo_Denoising.speed` → `perf/perf_denoising.cpp`: a `getTickCount` + `printf` stopwatch in the accuracy suite, asserting nothing, costing 393 ms per run. ### Library fixes found while doing the above - **ptcloud** — `findPlanes` now converts 3-channel input instead of reshaping it: `Mat_<Vec4f>::operator=` reshapes when depths match, so a 320×240 `CV_32FC3` input silently became 240×240. - **ptcloud** — new `RGBD_Plane.regression_3channel_matches_4channel`: nothing covered the documented 3-channel path, since all 40 `RgbdPlaneGenerate` cases feed `CV_32FC4`. ### 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:
@@ -722,4 +722,36 @@ TEST(RGBD_Plane, regression2309ValgrindCheck)
|
||||
findPlanes(points, noArray(), mask, planes, blockSize);
|
||||
}
|
||||
|
||||
TEST(RGBD_Plane, regression_3channel_matches_4channel)
|
||||
{
|
||||
const int rows = 240, cols = 320;
|
||||
|
||||
Mat points3(rows, cols, CV_32FC3);
|
||||
Mat points4(rows, cols, CV_32FC4);
|
||||
for (int v = 0; v < rows; v++)
|
||||
{
|
||||
for (int u = 0; u < cols; u++)
|
||||
{
|
||||
const float z = 2.f + 0.001f * u + 0.002f * v;
|
||||
const Vec3f p((float)u * 0.01f, (float)v * 0.01f, z);
|
||||
points3.at<Vec3f>(v, u) = p;
|
||||
points4.at<Vec4f>(v, u) = Vec4f(p[0], p[1], p[2], 0.f);
|
||||
}
|
||||
}
|
||||
|
||||
Mat mask3, mask4;
|
||||
std::vector<Vec4f> planes3, planes4;
|
||||
findPlanes(points3, noArray(), mask3, planes3);
|
||||
findPlanes(points4, noArray(), mask4, planes4);
|
||||
|
||||
EXPECT_EQ(points3.size(), mask3.size());
|
||||
EXPECT_EQ(CV_8U, mask3.type());
|
||||
|
||||
ASSERT_EQ(mask4.size(), mask3.size());
|
||||
EXPECT_EQ(0, cv::countNonZero(mask3 != mask4));
|
||||
ASSERT_EQ(planes4.size(), planes3.size());
|
||||
for (size_t i = 0; i < planes3.size(); i++)
|
||||
EXPECT_LE(cv::norm(planes3[i], planes4[i], NORM_INF), 1e-6) << "plane " << i;
|
||||
}
|
||||
|
||||
}} // namespace
|
||||
|
||||
Reference in New Issue
Block a user