mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Merge pull request #25030 from asmorkalov:as/fisheye_initial_f
Changed initial estimation for F in fisheye calibration
This commit is contained in:
commit
7bea25a60c
@ -799,7 +799,7 @@ double cv::fisheye::calibrate(InputArrayOfArrays objectPoints, InputArrayOfArray
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
finalParam.Init(Vec2d(max(image_size.width, image_size.height) / CV_PI, max(image_size.width, image_size.height) / CV_PI),
|
finalParam.Init(Vec2d(max(image_size.width, image_size.height) / 2., max(image_size.width, image_size.height) / 2.),
|
||||||
Vec2d(image_size.width / 2.0 - 0.5, image_size.height / 2.0 - 0.5));
|
Vec2d(image_size.width / 2.0 - 0.5, image_size.height / 2.0 - 0.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,6 +410,11 @@ TEST_F(fisheyeTest, Calibration)
|
|||||||
{
|
{
|
||||||
const int n_images = 34;
|
const int n_images = 34;
|
||||||
|
|
||||||
|
const cv::Matx33d goldK(558.4780870585967, 0, 620.4585053962692,
|
||||||
|
0, 560.5067667343917, 381.9394122875291,
|
||||||
|
0, 0, 1);
|
||||||
|
const cv::Vec4d goldD(-0.00146136, -0.00329847, 0.00605742, -0.00374201);
|
||||||
|
|
||||||
std::vector<std::vector<cv::Point2d> > imagePoints(n_images);
|
std::vector<std::vector<cv::Point2d> > imagePoints(n_images);
|
||||||
std::vector<std::vector<cv::Point3d> > objectPoints(n_images);
|
std::vector<std::vector<cv::Point3d> > objectPoints(n_images);
|
||||||
|
|
||||||
@ -437,8 +442,8 @@ TEST_F(fisheyeTest, Calibration)
|
|||||||
cv::fisheye::calibrate(objectPoints, imagePoints, imageSize, theK, theD,
|
cv::fisheye::calibrate(objectPoints, imagePoints, imageSize, theK, theD,
|
||||||
cv::noArray(), cv::noArray(), flag, cv::TermCriteria(3, 20, 1e-6));
|
cv::noArray(), cv::noArray(), flag, cv::TermCriteria(3, 20, 1e-6));
|
||||||
|
|
||||||
EXPECT_MAT_NEAR(theK, this->K, 1e-10);
|
EXPECT_MAT_NEAR(theK, goldK, 1e-8);
|
||||||
EXPECT_MAT_NEAR(theD, this->D, 1e-10);
|
EXPECT_MAT_NEAR(theD, goldD, 1e-8);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(fisheyeTest, CalibrationWithFixedFocalLength)
|
TEST_F(fisheyeTest, CalibrationWithFixedFocalLength)
|
||||||
@ -597,10 +602,10 @@ TEST_F(fisheyeTest, EstimateUncertainties)
|
|||||||
cv::internal::EstimateUncertainties(objectPoints, imagePoints, param, rvec, tvec,
|
cv::internal::EstimateUncertainties(objectPoints, imagePoints, param, rvec, tvec,
|
||||||
errors, err_std, thresh_cond, check_cond, rms);
|
errors, err_std, thresh_cond, check_cond, rms);
|
||||||
|
|
||||||
EXPECT_MAT_NEAR(errors.f, cv::Vec2d(1.34250246865020720, 1.36037536429654530), 1e-10);
|
EXPECT_MAT_NEAR(errors.f, cv::Vec2d(1.34250246865020720, 1.36037536429654530), 1e-6);
|
||||||
EXPECT_MAT_NEAR(errors.c, cv::Vec2d(0.92070526160049848, 0.84383585812851514), 1e-10);
|
EXPECT_MAT_NEAR(errors.c, cv::Vec2d(0.92070526160049848, 0.84383585812851514), 1e-6);
|
||||||
EXPECT_MAT_NEAR(errors.k, cv::Vec4d(0.0053379581373996041, 0.017389792901700545, 0.022036256089491224, 0.0094714594258908952), 1e-10);
|
EXPECT_MAT_NEAR(errors.k, cv::Vec4d(0.0053379581373996041, 0.017389792901700545, 0.022036256089491224, 0.0094714594258908952), 1e-7);
|
||||||
EXPECT_MAT_NEAR(err_std, cv::Vec2d(0.187475975266883, 0.185678953263995), 1e-10);
|
EXPECT_MAT_NEAR(err_std, cv::Vec2d(0.187475975266883, 0.185678953263995), 1e-7);
|
||||||
CV_Assert(fabs(rms - 0.263782587133546) < 1e-10);
|
CV_Assert(fabs(rms - 0.263782587133546) < 1e-10);
|
||||||
CV_Assert(errors.alpha == 0);
|
CV_Assert(errors.alpha == 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user