Commit 650bf430 authored by catree's avatar catree

Update code to take into account solvePnP and solvePnPRansac use…

Update code to take into account solvePnP and solvePnPRansac use InputOutputArray for rvec and tvec parameters.
parent d6895a1b
...@@ -387,8 +387,8 @@ class CV_EXPORTS_W GridBoard : public Board { ...@@ -387,8 +387,8 @@ class CV_EXPORTS_W GridBoard : public Board {
* Note that returning a 0 means the pose has not been estimated. * Note that returning a 0 means the pose has not been estimated.
*/ */
CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, const Ptr<Board> &board, CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, const Ptr<Board> &board,
InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec, InputArray cameraMatrix, InputArray distCoeffs, InputOutputArray rvec,
OutputArray tvec, bool useExtrinsicGuess = false); InputOutputArray tvec, bool useExtrinsicGuess = false);
......
...@@ -184,8 +184,8 @@ CV_EXPORTS_W int interpolateCornersCharuco(InputArrayOfArrays markerCorners, Inp ...@@ -184,8 +184,8 @@ CV_EXPORTS_W int interpolateCornersCharuco(InputArrayOfArrays markerCorners, Inp
*/ */
CV_EXPORTS_W bool estimatePoseCharucoBoard(InputArray charucoCorners, InputArray charucoIds, CV_EXPORTS_W bool estimatePoseCharucoBoard(InputArray charucoCorners, InputArray charucoIds,
const Ptr<CharucoBoard> &board, InputArray cameraMatrix, const Ptr<CharucoBoard> &board, InputArray cameraMatrix,
InputArray distCoeffs, OutputArray rvec, OutputArray tvec, InputArray distCoeffs, InputOutputArray rvec,
bool useExtrinsicGuess = false); InputOutputArray tvec, bool useExtrinsicGuess = false);
......
...@@ -1579,8 +1579,8 @@ void refineDetectedMarkers(InputArray _image, const Ptr<Board> &_board, ...@@ -1579,8 +1579,8 @@ void refineDetectedMarkers(InputArray _image, const Ptr<Board> &_board,
/** /**
*/ */
int estimatePoseBoard(InputArrayOfArrays _corners, InputArray _ids, const Ptr<Board> &board, int estimatePoseBoard(InputArrayOfArrays _corners, InputArray _ids, const Ptr<Board> &board,
InputArray _cameraMatrix, InputArray _distCoeffs, OutputArray _rvec, InputArray _cameraMatrix, InputArray _distCoeffs, InputOutputArray _rvec,
OutputArray _tvec, bool useExtrinsicGuess) { InputOutputArray _tvec, bool useExtrinsicGuess) {
CV_Assert(_corners.total() == _ids.total()); CV_Assert(_corners.total() == _ids.total());
......
...@@ -656,7 +656,7 @@ static bool _arePointsEnoughForPoseEstimation(const vector< Point3f > &points) { ...@@ -656,7 +656,7 @@ static bool _arePointsEnoughForPoseEstimation(const vector< Point3f > &points) {
*/ */
bool estimatePoseCharucoBoard(InputArray _charucoCorners, InputArray _charucoIds, bool estimatePoseCharucoBoard(InputArray _charucoCorners, InputArray _charucoIds,
const Ptr<CharucoBoard> &_board, InputArray _cameraMatrix, InputArray _distCoeffs, const Ptr<CharucoBoard> &_board, InputArray _cameraMatrix, InputArray _distCoeffs,
OutputArray _rvec, OutputArray _tvec, bool useExtrinsicGuess) { InputOutputArray _rvec, InputOutputArray _tvec, bool useExtrinsicGuess) {
CV_Assert((_charucoCorners.getMat().total() == _charucoIds.getMat().total())); CV_Assert((_charucoCorners.getMat().total() == _charucoIds.getMat().total()));
......
...@@ -96,21 +96,21 @@ public: ...@@ -96,21 +96,21 @@ public:
Calls the calirateCamera function with the same inputs. Calls the calirateCamera function with the same inputs.
*/ */
bool findRt(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, bool findRt(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs,
OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE); InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE);
bool findRt(InputArray image, InputArray cameraMatrix, InputArray distCoeffs, bool findRt(InputArray image, InputArray cameraMatrix, InputArray distCoeffs,
OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE); InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess = false, int flags = SOLVEPNP_ITERATIVE);
/**< /**<
Uses solvePnP to find the rotation and translation of the pattern Uses solvePnP to find the rotation and translation of the pattern
with respect to the camera frame. with respect to the camera frame.
*/ */
bool findRtRANSAC(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, bool findRtRANSAC(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs,
OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess = false, int iterationsCount = 100, InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess = false, int iterationsCount = 100,
float reprojectionError = 8.0, int minInliersCount = 100, OutputArray inliers = noArray(), int flags = SOLVEPNP_ITERATIVE); float reprojectionError = 8.0, int minInliersCount = 100, OutputArray inliers = noArray(), int flags = SOLVEPNP_ITERATIVE);
bool findRtRANSAC(InputArray image, InputArray cameraMatrix, InputArray distCoeffs, bool findRtRANSAC(InputArray image, InputArray cameraMatrix, InputArray distCoeffs,
OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess = false, int iterationsCount = 100, InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess = false, int iterationsCount = 100,
float reprojectionError = 8.0, int minInliersCount = 100, OutputArray inliers = noArray(), int flags = SOLVEPNP_ITERATIVE); float reprojectionError = 8.0, int minInliersCount = 100, OutputArray inliers = noArray(), int flags = SOLVEPNP_ITERATIVE);
/**< /**<
Uses solvePnPRansac() Uses solvePnPRansac()
*/ */
......
...@@ -425,13 +425,13 @@ double CustomPattern::calibrate(InputArrayOfArrays objectPoints, InputArrayOfArr ...@@ -425,13 +425,13 @@ double CustomPattern::calibrate(InputArrayOfArrays objectPoints, InputArrayOfArr
} }
bool CustomPattern::findRt(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, bool CustomPattern::findRt(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix,
InputArray distCoeffs, OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess, int flags) InputArray distCoeffs, InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess, int flags)
{ {
return solvePnP(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, flags); return solvePnP(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, flags);
} }
bool CustomPattern::findRt(InputArray image, InputArray cameraMatrix, InputArray distCoeffs, bool CustomPattern::findRt(InputArray image, InputArray cameraMatrix, InputArray distCoeffs,
OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess, int flags) InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess, int flags)
{ {
vector<Point2f> imagePoints; vector<Point2f> imagePoints;
vector<Point3f> objectPoints; vector<Point3f> objectPoints;
...@@ -442,17 +442,17 @@ bool CustomPattern::findRt(InputArray image, InputArray cameraMatrix, InputArray ...@@ -442,17 +442,17 @@ bool CustomPattern::findRt(InputArray image, InputArray cameraMatrix, InputArray
} }
bool CustomPattern::findRtRANSAC(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs, bool CustomPattern::findRtRANSAC(InputArray objectPoints, InputArray imagePoints, InputArray cameraMatrix, InputArray distCoeffs,
OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess, int iterationsCount, InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess, int iterationsCount,
float reprojectionError, int minInliersCount, OutputArray inliers, int flags) float reprojectionError, int minInliersCount, OutputArray inliers, int flags)
{ {
solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess,
iterationsCount, reprojectionError, minInliersCount, inliers, flags); iterationsCount, reprojectionError, minInliersCount, inliers, flags);
return true; // for consistency with the other methods return true; // for consistency with the other methods
} }
bool CustomPattern::findRtRANSAC(InputArray image, InputArray cameraMatrix, InputArray distCoeffs, bool CustomPattern::findRtRANSAC(InputArray image, InputArray cameraMatrix, InputArray distCoeffs,
OutputArray rvec, OutputArray tvec, bool useExtrinsicGuess, int iterationsCount, InputOutputArray rvec, InputOutputArray tvec, bool useExtrinsicGuess, int iterationsCount,
float reprojectionError, int minInliersCount, OutputArray inliers, int flags) float reprojectionError, int minInliersCount, OutputArray inliers, int flags)
{ {
vector<Point2f> imagePoints; vector<Point2f> imagePoints;
vector<Point3f> objectPoints; vector<Point3f> objectPoints;
...@@ -460,7 +460,7 @@ bool CustomPattern::findRtRANSAC(InputArray image, InputArray cameraMatrix, Inpu ...@@ -460,7 +460,7 @@ bool CustomPattern::findRtRANSAC(InputArray image, InputArray cameraMatrix, Inpu
if (!findPattern(image, imagePoints, objectPoints)) if (!findPattern(image, imagePoints, objectPoints))
return false; return false;
solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess, solvePnPRansac(objectPoints, imagePoints, cameraMatrix, distCoeffs, rvec, tvec, useExtrinsicGuess,
iterationsCount, reprojectionError, minInliersCount, inliers, flags); iterationsCount, reprojectionError, minInliersCount, inliers, flags);
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment