Commit 06939f16 authored by Pavel Rojtberg's avatar Pavel Rojtberg

aruco: interpolateCornersCharuco - make minMarkers property configurable

allows trading corner precision for corner quantity
parent 25575af6
......@@ -146,6 +146,7 @@ class CV_EXPORTS_W CharucoBoard : public Board {
* \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$
* @param distCoeffs optional vector of distortion coefficients
* \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements
* @param minMarkers number of adjacent markers that must be detected to return a charuco corner
*
* This function receives the detected markers and returns the 2D position of the chessboard corners
* from a ChArUco board using the detected Aruco markers. If camera parameters are provided,
......@@ -158,7 +159,7 @@ CV_EXPORTS_W int interpolateCornersCharuco(InputArrayOfArrays markerCorners, Inp
InputArray image, const Ptr<CharucoBoard> &board,
OutputArray charucoCorners, OutputArray charucoIds,
InputArray cameraMatrix = noArray(),
InputArray distCoeffs = noArray());
InputArray distCoeffs = noArray(), int minMarkers = 2);
......
......@@ -486,15 +486,8 @@ static int _interpolateCornersCharucoApproxCalib(InputArrayOfArrays _markerCorne
subPixWinSizes);
// filter corners outside the image and subpixel-refine charuco corners
unsigned int nRefinedCorners;
nRefinedCorners = _selectAndRefineChessboardCorners(
allChessboardImgPoints, _image, _charucoCorners, _charucoIds, subPixWinSizes);
// to return a charuco corner, its two closes aruco markers should have been detected
nRefinedCorners = _filterCornersWithoutMinMarkers(_board, _charucoCorners, _charucoIds,
_markerIds, 2, _charucoCorners, _charucoIds);
return nRefinedCorners;
return _selectAndRefineChessboardCorners(allChessboardImgPoints, _image, _charucoCorners,
_charucoIds, subPixWinSizes);
}
......@@ -576,15 +569,8 @@ static int _interpolateCornersCharucoLocalHom(InputArrayOfArrays _markerCorners,
// filter corners outside the image and subpixel-refine charuco corners
unsigned int nRefinedCorners;
nRefinedCorners = _selectAndRefineChessboardCorners(
allChessboardImgPoints, _image, _charucoCorners, _charucoIds, subPixWinSizes);
// to return a charuco corner, its two closes aruco markers should have been detected
nRefinedCorners = _filterCornersWithoutMinMarkers(_board, _charucoCorners, _charucoIds,
_markerIds, 2, _charucoCorners, _charucoIds);
return nRefinedCorners;
return _selectAndRefineChessboardCorners(allChessboardImgPoints, _image, _charucoCorners,
_charucoIds, subPixWinSizes);
}
......@@ -594,19 +580,23 @@ static int _interpolateCornersCharucoLocalHom(InputArrayOfArrays _markerCorners,
int interpolateCornersCharuco(InputArrayOfArrays _markerCorners, InputArray _markerIds,
InputArray _image, const Ptr<CharucoBoard> &_board,
OutputArray _charucoCorners, OutputArray _charucoIds,
InputArray _cameraMatrix, InputArray _distCoeffs) {
InputArray _cameraMatrix, InputArray _distCoeffs, int minMarkers) {
// if camera parameters are avaible, use approximated calibration
if(_cameraMatrix.total() != 0) {
return _interpolateCornersCharucoApproxCalib(_markerCorners, _markerIds, _image, _board,
_interpolateCornersCharucoApproxCalib(_markerCorners, _markerIds, _image, _board,
_cameraMatrix, _distCoeffs, _charucoCorners,
_charucoIds);
}
// else use local homography
else {
return _interpolateCornersCharucoLocalHom(_markerCorners, _markerIds, _image, _board,
_interpolateCornersCharucoLocalHom(_markerCorners, _markerIds, _image, _board,
_charucoCorners, _charucoIds);
}
// to return a charuco corner, its closest aruco markers should have been detected
return _filterCornersWithoutMinMarkers(_board, _charucoCorners, _charucoIds, _markerIds,
minMarkers, _charucoCorners, _charucoIds);
}
......
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