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

Merge branch 4.x

This commit is contained in:
Alexander Smorkalov
2026-02-19 17:10:14 +03:00
120 changed files with 650 additions and 465 deletions
@@ -205,9 +205,11 @@ TEST(CV_ArucoTutorial, can_find_diamondmarkers)
const size_t diamondsN = 3;
// corners of diamonds with Vec4i indices
const float goldDiamondCorners[diamondsN][8] = {{195.6f,150.9f, 213.5f,201.2f, 136.4f,215.3f, 122.4f,163.5f},
{501.1f,171.3f, 501.9f,208.5f, 446.2f,199.8f, 447.8f,163.3f},
{343.4f,361.2f, 359.7f,328.7f, 400.8f,344.6f, 385.7f,378.4f}};
// Note: Values adjusted by -0.5px after fixing the systematic offset bug in charuco_detector.cpp
// The fix removes the incorrect +0.5 offset that was added after cornerSubPix
const float goldDiamondCorners[diamondsN][8] = {{195.1f,150.4f, 213.0f,200.7f, 135.9f,214.8f, 121.9f,163.0f},
{500.6f,170.8f, 501.4f,208.0f, 445.7f,199.3f, 447.3f,162.8f},
{342.9f,360.7f, 359.2f,328.2f, 400.3f,344.1f, 385.2f,377.9f}};
auto comp = [](const Vec4i& a, const Vec4i& b) {
for (int i = 0; i < 3; i++)
if (a[i] != b[i]) return a[i] < b[i];
@@ -602,16 +602,18 @@ TEST(Charuco, testBoardSubpixelCoords)
0, 0, 1);
// set expected_corners values
// Note: Values adjusted by -0.5px after fixing the systematic offset bug in charuco_detector.cpp
// The fix removes the incorrect +0.5 offset that was added after cornerSubPix
cv::Mat expected_corners = (cv::Mat_<float>(9,2) <<
200, 200,
250, 200,
300, 200,
200, 250,
250, 250,
300, 250,
200, 300,
250, 300,
300, 300
199.5, 199.5,
249.5, 199.5,
299.5, 199.5,
199.5, 249.5,
249.5, 249.5,
299.5, 249.5,
199.5, 299.5,
249.5, 299.5,
299.5, 299.5
);
std::vector<int> shape={expected_corners.rows};
expected_corners = expected_corners.reshape(2, shape);
@@ -904,16 +906,18 @@ TEST(Charuco, DISABLED_testSeveralBoardsWithCustomIds)
0, 0.5*res.height, 0.5*res.height,
0, 0, 1);
// Expected corner coordinates adjusted by -0.5px after fixing the systematic offset bug
// The fix removes the incorrect +0.5 offset that was added after cornerSubPix
Mat expected_corners = (Mat_<float>(9,2) <<
200, 200,
250, 200,
300, 200,
200, 250,
250, 250,
300, 250,
200, 300,
250, 300,
300, 300
199.5, 199.5,
249.5, 199.5,
299.5, 199.5,
199.5, 249.5,
249.5, 249.5,
299.5, 249.5,
199.5, 299.5,
249.5, 299.5,
299.5, 299.5
);
@@ -945,11 +949,11 @@ TEST(Charuco, DISABLED_testSeveralBoardsWithCustomIds)
// In 4.x detectBoard() returns the charuco corners in a 2D Mat with shape (N_corners, 1)
// In 5.x, after PR #23473, detectBoard() returns the charuco corners in a 1D Mat with shape (1, N_corners)
ASSERT_EQ(expected_corners.total(), c_corners1.total()*c_corners1.channels());
EXPECT_NEAR(0., cvtest::norm(expected_corners.reshape(1, 1), c_corners1.reshape(1, 1), NORM_INF), 3e-1);
EXPECT_NEAR(0., cvtest::norm(expected_corners.reshape(1, 1), c_corners1.reshape(1, 1), NORM_INF), 0.1);
ASSERT_EQ(expected_corners.total(), c_corners2.total()*c_corners2.channels());
expected_corners.col(0) += 500;
EXPECT_NEAR(0., cvtest::norm(expected_corners.reshape(1, 1), c_corners2.reshape(1, 1), NORM_INF), 3e-1);
EXPECT_NEAR(0., cvtest::norm(expected_corners.reshape(1, 1), c_corners2.reshape(1, 1), NORM_INF), 0.1);
}
}} // namespace