mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 06:26:29 +08:00
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
This commit is contained in:
parent
8ca4252303
commit
ba0ed79635
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user