Commit ba0ed796 authored by Kang Yifei's avatar Kang Yifei Committed by Alexander Alekhin

Merge pull request #14800 from FanaticsKang:add_undistortPoint_test

Test request by #14583 (#14800)

* add test to show the undistort bug

* move test to calib3d
parent 8ca42523
......@@ -119,4 +119,30 @@ TEST(Calib3d_Undistort, stop_criteria)
ASSERT_LE(obtainedError, maxError);
}
TEST(undistortPoints, regression_14583)
{
const int col = 720;
// const int row = 540;
float camera_matrix_value[] = {
437.8995f, 0.0f, 342.9241f,
0.0f, 438.8216f, 273.7163f,
0.0f, 0.0f, 1.0f
};
cv::Mat camera_interior(3, 3, CV_32F, camera_matrix_value);
float camera_distort_value[] = {-0.34329f, 0.11431f, 0.0f, 0.0f, -0.017375f};
cv::Mat camera_distort(1, 5, CV_32F, camera_distort_value);
float distort_points_value[] = {col, 0.};
cv::Mat distort_pt(1, 1, CV_32FC2, distort_points_value);
cv::Mat undistort_pt;
cv::undistortPoints(distort_pt, undistort_pt, camera_interior,
camera_distort, cv::Mat(), camera_interior);
EXPECT_NEAR(distort_pt.at<Vec2f>(0)[0], undistort_pt.at<Vec2f>(0)[0], col / 2)
<< "distort point: " << distort_pt << std::endl
<< "undistort point: " << undistort_pt;
}
}} // namespace
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment