mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 15:53:03 +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
@@ -4055,6 +4055,45 @@ optimization. It is the \f$max(width,height)/\pi\f$ or the provided \f$f_x\f$, \
|
||||
OutputArray R, OutputArray T, int flags = fisheye::CALIB_FIX_INTRINSIC,
|
||||
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 100, DBL_EPSILON));
|
||||
|
||||
/**
|
||||
@brief Finds an object pose from 3D-2D point correspondences for fisheye camera moodel.
|
||||
|
||||
@param objectPoints Array of object points in the object coordinate space, Nx3 1-channel or
|
||||
1xN/Nx1 3-channel, where N is the number of points. vector\<Point3d\> can be also passed here.
|
||||
@param imagePoints Array of corresponding image points, Nx2 1-channel or 1xN/Nx1 2-channel,
|
||||
where N is the number of points. vector\<Point2d\> can be also passed here.
|
||||
@param cameraMatrix Input camera intrinsic matrix \f$\cameramatrix{A}\f$ .
|
||||
@param distCoeffs Input vector of distortion coefficients (4x1/1x4).
|
||||
@param rvec Output rotation vector (see @ref Rodrigues ) that, together with tvec, brings points from
|
||||
the model coordinate system to the camera coordinate system.
|
||||
@param tvec Output translation vector.
|
||||
@param useExtrinsicGuess Parameter used for #SOLVEPNP_ITERATIVE. If true (1), the function uses
|
||||
the provided rvec and tvec values as initial approximations of the rotation and translation
|
||||
vectors, respectively, and further optimizes them.
|
||||
@param flags Method for solving a PnP problem: see @ref calib3d_solvePnP_flags
|
||||
This function returns the rotation and the translation vectors that transform a 3D point expressed in the object
|
||||
coordinate frame to the camera coordinate frame, using different methods:
|
||||
- P3P methods (@ref SOLVEPNP_P3P, @ref SOLVEPNP_AP3P): need 4 input points to return a unique solution.
|
||||
- @ref SOLVEPNP_IPPE Input points must be >= 4 and object points must be coplanar.
|
||||
- @ref SOLVEPNP_IPPE_SQUARE Special case suitable for marker pose estimation.
|
||||
Number of input points must be 4. Object points must be defined in the following order:
|
||||
- point 0: [-squareLength / 2, squareLength / 2, 0]
|
||||
- point 1: [ squareLength / 2, squareLength / 2, 0]
|
||||
- point 2: [ squareLength / 2, -squareLength / 2, 0]
|
||||
- point 3: [-squareLength / 2, -squareLength / 2, 0]
|
||||
- for all the other flags, number of input points must be >= 4 and object points can be in any configuration.
|
||||
@param criteria Termination criteria for internal undistortPoints call.
|
||||
The function interally undistorts points with @ref undistortPoints and call @ref cv::solvePnP,
|
||||
thus the input are very similar. Check there and Perspective-n-Points is described in @ref calib3d_solvePnP
|
||||
for more information.
|
||||
*/
|
||||
CV_EXPORTS_W bool solvePnP( InputArray objectPoints, InputArray imagePoints,
|
||||
InputArray cameraMatrix, InputArray distCoeffs,
|
||||
OutputArray rvec, OutputArray tvec,
|
||||
bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE,
|
||||
TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 10, 1e-8)
|
||||
);
|
||||
|
||||
//! @} calib3d_fisheye
|
||||
} // end namespace fisheye
|
||||
|
||||
|
||||
Reference in New Issue
Block a user