mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge pull request #25028 from asmorkalov:as/fisheye_solvepnp
solvePnP implementation for Fisheye camera model #25028 Credits to Linfei Pan Extracted from https://github.com/opencv/opencv/pull/24052 **Warning:** The patch changes Obj-C generator behaviour and adds "fisheye_" prefix for all ObjC functions from namespace. ### 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 - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake Co-authored-by: lpanaf <linpan@student.ethz.ch> Co-authored-by: Vadim Levin <vadim.levin@xperience.ai>
This commit is contained in:
committed by
GitHub
parent
7bea25a60c
commit
bd73b7bcf5
@@ -150,6 +150,28 @@ TEST_F(fisheyeTest, distortUndistortPoints)
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(fisheyeTest, solvePnP)
|
||||
{
|
||||
const int n = 16;
|
||||
|
||||
cv::Mat obj_points(1, n, CV_64FC3);
|
||||
theRNG().fill(obj_points, cv::RNG::NORMAL, 2, 1);
|
||||
obj_points = cv::abs(obj_points) * 10;
|
||||
|
||||
cv::Mat rvec;
|
||||
cv::Rodrigues(this->R, rvec);
|
||||
cv::Mat img_points;
|
||||
cv::fisheye::projectPoints(obj_points, img_points, rvec, this->T, this->K, this->D);
|
||||
|
||||
cv::Mat rvec_pred;
|
||||
cv::Mat tvec_pred;
|
||||
bool converged = cv::fisheye::solvePnP(obj_points, img_points, this->K, this->D, rvec_pred, tvec_pred);
|
||||
EXPECT_MAT_NEAR(rvec, rvec_pred, 1e-6);
|
||||
EXPECT_MAT_NEAR(this->T, tvec_pred, 1e-6);
|
||||
|
||||
ASSERT_TRUE(converged);
|
||||
}
|
||||
|
||||
TEST_F(fisheyeTest, undistortImage)
|
||||
{
|
||||
// we use it to reduce patch size for images in testdata
|
||||
|
||||
Reference in New Issue
Block a user