Repository navigation
Open
Description
System information (version)
- OpenCV => master
Detailed description
See the code
opencv/modules/calib3d/include/opencv2/calib3d.hpp
Lines 692 to 695 in ee1e1ce
| CV_EXPORTS_W bool solvePnP( InputArray objectPoints, InputArray imagePoints, | |
| InputArray cameraMatrix, InputArray distCoeffs, | |
| OutputArray rvec, OutputArray tvec, | |
| bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE ); |
rvec and tvec are of type OutputArray indicating that they are used only for ouput.
But the code
opencv/modules/calib3d/src/solvepnp.cpp
Line 58 in ee1e1ce
| OutputArray _rvec, OutputArray _tvec, bool useExtrinsicGuess, int flags ) |
opencv/modules/calib3d/src/solvepnp.cpp
Lines 71 to 79 in ee1e1ce
| if( useExtrinsicGuess ) | |
| { | |
| int rtype = _rvec.type(), ttype = _tvec.type(); | |
| Size rsize = _rvec.size(), tsize = _tvec.size(); | |
| CV_Assert( (rtype == CV_32F || rtype == CV_64F) && | |
| (ttype == CV_32F || ttype == CV_64F) ); | |
| CV_Assert( (rsize == Size(1, 3) || rsize == Size(3, 1)) && | |
| (tsize == Size(1, 3) || tsize == Size(3, 1)) ); | |
| } |
treats them as input when
useExtrinsicGuess==true.
Suggestions
The prototype should be decalared as InputOutputArray.
Reacted by Alex Martens and Julian Gaal
Activity
alalek commentedon Aug 29, 2018
related issue with another function: #12012
csukuangfj commentedon Aug 29, 2018
@alalek
The same problem exists for
cv::solvePnPRansac()asmorkalov commentedon Dec 5, 2025
Moved to 5.x as the changes break API.