mirror of
https://github.com/opencv/opencv.git
synced 2026-07-28 23:03:03 +04:00
f5014c179f
Update Gao P3P with Ding P3P #27736 ### 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 --- The current Gao P3P implementation does not cover all the degenerate cases, **see last line** in: https://github.com/opencv/opencv/blob/6d889ee74c94124f6492eb8f0d50946d9c31d8e9/modules/calib3d/src/p3p.cpp#L211-L221 See also: - https://github.com/opencv/opencv/issues/4854 --- <details> <summary>OBSOLETE</summary> To fix this, the USAC P3P from OpenCV 5 is used instead: https://github.com/opencv/opencv/blob/7e6da007cddcf83a527dfda95d57228fa5a535d3/modules/3d/src/usac/pnp_solver.cpp#L282 --- ## Some results ### Old P3P vs new In the following video, I have tried to highlight the viewpoints which cause issues: https://github.com/user-attachments/assets/97bec6a6-4043-4509-b50e-a9856d6423bd | | Old P3P | New P3P | | -------- | ------- | ------- | | Mean (ms) | 0.045701 | 0.024816 | | Median (ms) | 0.025146 | 0.023193 | | Std (ms) | 0.028953 | 0.006124 | ### New P3P vs AP3P https://github.com/user-attachments/assets/eaeb21dc-3ffd-4b6c-9902-4352f824aa45 The AP3 method is superior both in term of accuracy and computation time: | | New P3P | AP3P | | -------- | ------- | ------- | | Mean (ms) | 0.043750 | 0.023442 | | Median (ms) | 0.023193 | 0.021484 | | Std (ms) | 0.039920 | 0.005265 | ### New P3P vs AP3P (range test) https://github.com/user-attachments/assets/572e7b7a-2966-4bed-8e0c-b93d863987dc The implemented P3P method does not work well when the tag is small, at long range. | | New P3P | AP3P | | -------- | ------- | ------- | | Mean (ms) | 0.031351 | 0.025189 | | Median (ms) | 0.022217 | 0.020996 | | Std (ms) | 0.024920 | 0.009633 | --- - I have tried to simplify the P3P code, hope I did not break the implementation code - calculations are performed using double type for simplicity. - code such as the following are redundant and no more needed and should be replaced by `cv::Rodrigues`: https://github.com/opencv/opencv/blob/6d889ee74c94124f6492eb8f0d50946d9c31d8e9/modules/calib3d/src/usac/pnp_solver.cpp#L395 </details>
65 lines
2.5 KiB
BibTeX
65 lines
2.5 KiB
BibTeX
@inproceedings{ding2023revisiting,
|
|
title={Revisiting the P3P Problem},
|
|
author={Ding, Yaqing and Yang, Jian and Larsson, Viktor and Olsson, Carl and {\AA}str{\"o}m, Kalle},
|
|
booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
|
|
pages={4872--4880},
|
|
year={2023},
|
|
url={https://openaccess.thecvf.com/content/CVPR2023/papers/Ding_Revisiting_the_P3P_Problem_CVPR_2023_paper.pdf}
|
|
}
|
|
@article{lepetit2009epnp,
|
|
title={Epnp: An accurate o (n) solution to the pnp problem},
|
|
author={Lepetit, Vincent and Moreno-Noguer, Francesc and Fua, Pascal},
|
|
journal={International journal of computer vision},
|
|
volume={81},
|
|
number={2},
|
|
pages={155--166},
|
|
year={2009},
|
|
publisher={Springer},
|
|
url={https://www.tugraz.at/fileadmin/user_upload/Institute/ICG/Images/team_lepetit/publications/lepetit_ijcv08.pdf}
|
|
}
|
|
|
|
@inproceedings{hesch2011direct,
|
|
title={A direct least-squares (DLS) method for PnP},
|
|
author={Hesch, Joel and Roumeliotis, Stergios and others},
|
|
booktitle={Computer Vision (ICCV), 2011 IEEE International Conference on},
|
|
pages={383--390},
|
|
year={2011},
|
|
organization={IEEE},
|
|
url={https://www-users.cse.umn.edu/~stergios/papers/ICCV-11-DLS-PnP.pdf}
|
|
}
|
|
|
|
@article{penate2013exhaustive,
|
|
title={Exhaustive linearization for robust camera pose and focal length estimation},
|
|
author={Penate-Sanchez, Adrian and Andrade-Cetto, Juan and Moreno-Noguer, Francesc},
|
|
journal={Pattern Analysis and Machine Intelligence, IEEE Transactions on},
|
|
volume={35},
|
|
number={10},
|
|
pages={2387--2400},
|
|
year={2013},
|
|
publisher={IEEE},
|
|
url={https://www.researchgate.net/publication/235402233_Exhaustive_Linearization_for_Robust_Camera_Pose_and_Focal_Length_Estimation}
|
|
}
|
|
|
|
@inproceedings{strobl2011iccv,
|
|
title={More accurate pinhole camera calibration with imperfect planar target},
|
|
author={Strobl, Klaus H. and Hirzinger, Gerd},
|
|
booktitle={2011 IEEE International Conference on Computer Vision (ICCV)},
|
|
pages={1068-1075},
|
|
month={Nov},
|
|
year={2011},
|
|
address={Barcelona, Spain},
|
|
publisher={IEEE},
|
|
url={https://elib.dlr.de/71888/1/strobl_2011iccv.pdf},
|
|
doi={10.1109/ICCVW.2011.6130369}
|
|
}
|
|
|
|
@inproceedings{Terzakis2020SQPnP,
|
|
title={A Consistently Fast and Globally Optimal Solution to the Perspective-n-Point Problem},
|
|
author={George Terzakis and Manolis Lourakis},
|
|
booktitle={European Conference on Computer Vision},
|
|
pages={478--494},
|
|
year={2020},
|
|
publisher={Springer International Publishing},
|
|
url={https://www.ecva.net/papers/eccv_2020/papers_ECCV/papers/123460460.pdf}
|
|
}
|