Commit 337487d4 authored by Marek Smigielski's avatar Marek Smigielski

Add support for java in aruco module

parent dd9b2eb4
set(the_description "ArUco Marker Detection")
ocv_define_module(aruco opencv_core opencv_imgproc opencv_calib3d WRAP python)
ocv_define_module(aruco opencv_core opencv_imgproc opencv_calib3d WRAP python java)
......@@ -173,7 +173,7 @@ struct CV_EXPORTS_W DetectorParameters {
* @sa estimatePoseSingleMarkers, estimatePoseBoard
*
*/
CV_EXPORTS_W void detectMarkers(InputArray image, Ptr<Dictionary> &dictionary, OutputArrayOfArrays corners,
CV_EXPORTS_W void detectMarkers(InputArray image, const Ptr<Dictionary> &dictionary, OutputArrayOfArrays corners,
OutputArray ids, const Ptr<DetectorParameters> &parameters = DetectorParameters::create(),
OutputArrayOfArrays rejectedImgPoints = noArray());
......@@ -277,7 +277,7 @@ class CV_EXPORTS_W GridBoard : public Board {
* the marker size and marker separation.
*/
CV_WRAP static Ptr<GridBoard> create(int markersX, int markersY, float markerLength,
float markerSeparation, Ptr<Dictionary> &dictionary, int firstMarker = 0);
float markerSeparation, const Ptr<Dictionary> &dictionary, int firstMarker = 0);
/**
*
......@@ -334,7 +334,7 @@ class CV_EXPORTS_W GridBoard : public Board {
* The function returns the number of markers from the input employed for the board pose estimation.
* Note that returning a 0 means the pose has not been estimated.
*/
CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, Ptr<Board> &board,
CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, const Ptr<Board> &board,
InputArray cameraMatrix, InputArray distCoeffs, OutputArray rvec,
OutputArray tvec);
......@@ -373,7 +373,7 @@ CV_EXPORTS_W int estimatePoseBoard(InputArrayOfArrays corners, InputArray ids, P
* homography, and all the marker corners in the board must have the same Z coordinate.
*/
CV_EXPORTS_W void refineDetectedMarkers(
InputArray image, Ptr<Board> &board, InputOutputArrayOfArrays detectedCorners,
InputArray image,const Ptr<Board> &board, InputOutputArrayOfArrays detectedCorners,
InputOutputArray detectedIds, InputOutputArrayOfArrays rejectedCorners,
InputArray cameraMatrix = noArray(), InputArray distCoeffs = noArray(),
float minRepDistance = 10.f, float errorCorrectionRate = 3.f, bool checkAllOrders = true,
......@@ -437,7 +437,7 @@ CV_EXPORTS_W void drawAxis(InputOutputArray image, InputArray cameraMatrix, Inpu
*
* This function returns a marker image in its canonical form (i.e. ready to be printed)
*/
CV_EXPORTS_W void drawMarker(Ptr<Dictionary> &dictionary, int id, int sidePixels, OutputArray img,
CV_EXPORTS_W void drawMarker(const Ptr<Dictionary> &dictionary, int id, int sidePixels, OutputArray img,
int borderBits = 1);
......@@ -457,7 +457,7 @@ CV_EXPORTS_W void drawMarker(Ptr<Dictionary> &dictionary, int id, int sidePixels
* This function return the image of a planar board, ready to be printed. It assumes
* the Board layout specified is planar by ignoring the z coordinates of the object points.
*/
CV_EXPORTS_W void drawPlanarBoard(Ptr<Board> &board, Size outSize, OutputArray img,
CV_EXPORTS_W void drawPlanarBoard(const Ptr<Board> &board, Size outSize, OutputArray img,
int marginSize = 0, int borderBits = 1);
......@@ -499,7 +499,7 @@ void _drawPlanarBoardImpl(Board *board, Size outSize, OutputArray img,
* calibration in calibrateCamera(). The function returns the final re-projection error.
*/
CV_EXPORTS_W double calibrateCameraAruco(
InputArrayOfArrays corners, InputArray ids, InputArray counter, Ptr<Board> &board,
InputArrayOfArrays corners, InputArray ids, InputArray counter, const Ptr<Board> &board,
Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
OutputArrayOfArrays rvecs = noArray(), OutputArrayOfArrays tvecs = noArray(), int flags = 0,
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
......
......@@ -98,7 +98,7 @@ class CV_EXPORTS_W CharucoBoard : public Board {
* and the size of the markers and chessboard squares.
*/
CV_WRAP static Ptr<CharucoBoard> create(int squaresX, int squaresY, float squareLength,
float markerLength, Ptr<Dictionary> &dictionary);
float markerLength, const Ptr<Dictionary> &dictionary);
/**
*
......@@ -155,7 +155,7 @@ class CV_EXPORTS_W CharucoBoard : public Board {
* The function returns the number of interpolated corners.
*/
CV_EXPORTS_W int interpolateCornersCharuco(InputArrayOfArrays markerCorners, InputArray markerIds,
InputArray image, Ptr<CharucoBoard> &board,
InputArray image, const Ptr<CharucoBoard> &board,
OutputArray charucoCorners, OutputArray charucoIds,
InputArray cameraMatrix = noArray(),
InputArray distCoeffs = noArray());
......@@ -181,7 +181,7 @@ CV_EXPORTS_W int interpolateCornersCharuco(InputArrayOfArrays markerCorners, Inp
* If pose estimation is valid, returns true, else returns false.
*/
CV_EXPORTS_W bool estimatePoseCharucoBoard(InputArray charucoCorners, InputArray charucoIds,
Ptr<CharucoBoard> &board, InputArray cameraMatrix,
const Ptr<CharucoBoard> &board, InputArray cameraMatrix,
InputArray distCoeffs, OutputArray rvec, OutputArray tvec);
......@@ -231,7 +231,7 @@ CV_EXPORTS_W void drawDetectedCornersCharuco(InputOutputArray image, InputArray
* The function returns the final re-projection error.
*/
CV_EXPORTS_W double calibrateCameraCharuco(
InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, Ptr<CharucoBoard> &board,
InputArrayOfArrays charucoCorners, InputArrayOfArrays charucoIds, const Ptr<CharucoBoard> &board,
Size imageSize, InputOutputArray cameraMatrix, InputOutputArray distCoeffs,
OutputArrayOfArrays rvecs = noArray(), OutputArrayOfArrays tvecs = noArray(), int flags = 0,
TermCriteria criteria = TermCriteria(TermCriteria::COUNT + TermCriteria::EPS, 30, DBL_EPSILON));
......@@ -309,7 +309,7 @@ CV_EXPORTS_W void drawDetectedDiamonds(InputOutputArray image, InputArrayOfArray
* This function return the image of a ChArUco marker, ready to be printed.
*/
// TODO cannot be exported yet; conversion from/to Vec4i is not wrapped in core
CV_EXPORTS void drawCharucoDiamond(Ptr<Dictionary> &dictionary, Vec4i ids, int squareLength,
CV_EXPORTS void drawCharucoDiamond(const Ptr<Dictionary> &dictionary, Vec4i ids, int squareLength,
int markerLength, OutputArray img, int marginSize = 0,
int borderBits = 1);
......
......@@ -91,7 +91,7 @@ class CV_EXPORTS_W Dictionary {
* @see generateCustomDictionary
*/
CV_WRAP_AS(create_from) static Ptr<Dictionary> create(int nMarkers, int markerSize,
Ptr<Dictionary> &baseDictionary);
const Ptr<Dictionary> &baseDictionary);
/**
* @see getPredefinedDictionary
......@@ -194,7 +194,7 @@ CV_EXPORTS_AS(custom_dictionary) Ptr<Dictionary> generateCustomDictionary(
CV_EXPORTS_AS(custom_dictionary_from) Ptr<Dictionary> generateCustomDictionary(
int nMarkers,
int markerSize,
Ptr<Dictionary> &baseDictionary);
const Ptr<Dictionary> &baseDictionary);
......
......@@ -498,7 +498,7 @@ static int _getBorderErrors(const Mat &bits, int markerSize, int borderSize) {
/**
* @brief Tries to identify one candidate given the dictionary
*/
static bool _identifyOneCandidate(Ptr<Dictionary> &dictionary, InputArray _image,
static bool _identifyOneCandidate(const Ptr<Dictionary> &dictionary, InputArray _image,
InputOutputArray _corners, int &idx, const Ptr<DetectorParameters> &params) {
CV_Assert(_corners.total() == 4);
......@@ -548,7 +548,7 @@ static bool _identifyOneCandidate(Ptr<Dictionary> &dictionary, InputArray _image
class IdentifyCandidatesParallel : public ParallelLoopBody {
public:
IdentifyCandidatesParallel(const Mat *_grey, InputArrayOfArrays _candidates,
InputArrayOfArrays _contours, Ptr<Dictionary> &_dictionary,
InputArrayOfArrays _contours, const Ptr<Dictionary> &_dictionary,
vector< int > *_idsTmp, vector< char > *_validCandidates,
const Ptr<DetectorParameters> &_params)
: grey(_grey), candidates(_candidates), contours(_contours), dictionary(_dictionary),
......@@ -573,7 +573,7 @@ class IdentifyCandidatesParallel : public ParallelLoopBody {
const Mat *grey;
InputArrayOfArrays candidates, contours;
Ptr<Dictionary> &dictionary;
const Ptr<Dictionary> &dictionary;
vector< int > *idsTmp;
vector< char > *validCandidates;
const Ptr<DetectorParameters> &params;
......@@ -629,7 +629,7 @@ void _copyVector2Output(vector< Mat > &vec, OutputArrayOfArrays out) {
* @brief Identify square candidates according to a marker dictionary
*/
static void _identifyCandidates(InputArray _image, InputArrayOfArrays _candidates,
InputArrayOfArrays _contours, Ptr<Dictionary> &_dictionary,
InputArrayOfArrays _contours, const Ptr<Dictionary> &_dictionary,
OutputArrayOfArrays _accepted, OutputArray _ids,
const Ptr<DetectorParameters> &params,
OutputArrayOfArrays _rejected = noArray()) {
......@@ -815,7 +815,7 @@ class MarkerSubpixelParallel : public ParallelLoopBody {
/**
*/
void detectMarkers(InputArray _image, Ptr<Dictionary> &_dictionary, OutputArrayOfArrays _corners,
void detectMarkers(InputArray _image, const Ptr<Dictionary> &_dictionary, OutputArrayOfArrays _corners,
OutputArray _ids, const Ptr<DetectorParameters> &_params,
OutputArrayOfArrays _rejectedImgPoints) {
......@@ -926,7 +926,7 @@ void estimatePoseSingleMarkers(InputArrayOfArrays _corners, float markerLength,
* @brief Given a board configuration and a set of detected markers, returns the corresponding
* image points and object points to call solvePnP
*/
static void _getBoardObjectAndImagePoints(Ptr<Board> &_board, InputArray _detectedIds,
static void _getBoardObjectAndImagePoints(const Ptr<Board> &_board, InputArray _detectedIds,
InputArrayOfArrays _detectedCorners,
OutputArray _imgPoints, OutputArray _objPoints) {
......@@ -969,7 +969,7 @@ static void _getBoardObjectAndImagePoints(Ptr<Board> &_board, InputArray _detect
/**
* Project board markers that are not included in the list of detected markers
*/
static void _projectUndetectedMarkers(Ptr<Board> &_board, InputOutputArrayOfArrays _detectedCorners,
static void _projectUndetectedMarkers(const Ptr<Board> &_board, InputOutputArrayOfArrays _detectedCorners,
InputOutputArray _detectedIds, InputArray _cameraMatrix,
InputArray _distCoeffs,
OutputArrayOfArrays _undetectedMarkersProjectedCorners,
......@@ -1027,7 +1027,7 @@ static void _projectUndetectedMarkers(Ptr<Board> &_board, InputOutputArrayOfArra
* Interpolate board markers that are not included in the list of detected markers using
* global homography
*/
static void _projectUndetectedMarkers(Ptr<Board> &_board, InputOutputArrayOfArrays _detectedCorners,
static void _projectUndetectedMarkers(const Ptr<Board> &_board, InputOutputArrayOfArrays _detectedCorners,
InputOutputArray _detectedIds,
OutputArrayOfArrays _undetectedMarkersProjectedCorners,
OutputArray _undetectedMarkersIds) {
......@@ -1097,7 +1097,7 @@ static void _projectUndetectedMarkers(Ptr<Board> &_board, InputOutputArrayOfArra
/**
*/
void refineDetectedMarkers(InputArray _image, Ptr<Board> &_board,
void refineDetectedMarkers(InputArray _image, const Ptr<Board> &_board,
InputOutputArrayOfArrays _detectedCorners, InputOutputArray _detectedIds,
InputOutputArrayOfArrays _rejectedCorners, InputArray _cameraMatrix,
InputArray _distCoeffs, float minRepDistance, float errorCorrectionRate,
......@@ -1296,7 +1296,7 @@ void refineDetectedMarkers(InputArray _image, Ptr<Board> &_board,
/**
*/
int estimatePoseBoard(InputArrayOfArrays _corners, InputArray _ids, Ptr<Board> &board,
int estimatePoseBoard(InputArrayOfArrays _corners, InputArray _ids, const Ptr<Board> &board,
InputArray _cameraMatrix, InputArray _distCoeffs, OutputArray _rvec,
OutputArray _tvec) {
......@@ -1332,7 +1332,7 @@ void GridBoard::draw(Size outSize, OutputArray _img, int marginSize, int borderB
/**
*/
Ptr<GridBoard> GridBoard::create(int markersX, int markersY, float markerLength, float markerSeparation,
Ptr<Dictionary> &dictionary, int firstMarker) {
const Ptr<Dictionary> &dictionary, int firstMarker) {
CV_Assert(markersX > 0 && markersY > 0 && markerLength > 0 && markerSeparation > 0);
......@@ -1448,7 +1448,7 @@ void drawAxis(InputOutputArray _image, InputArray _cameraMatrix, InputArray _dis
/**
*/
void drawMarker(Ptr<Dictionary> &dictionary, int id, int sidePixels, OutputArray _img, int borderBits) {
void drawMarker(const Ptr<Dictionary> &dictionary, int id, int sidePixels, OutputArray _img, int borderBits) {
dictionary->drawMarker(id, sidePixels, _img, borderBits);
}
......@@ -1552,7 +1552,7 @@ void _drawPlanarBoardImpl(Board *_board, Size outSize, OutputArray _img, int mar
/**
*/
void drawPlanarBoard(Ptr<Board> &_board, Size outSize, OutputArray _img, int marginSize,
void drawPlanarBoard(const Ptr<Board> &_board, Size outSize, OutputArray _img, int marginSize,
int borderBits) {
_drawPlanarBoardImpl(_board, outSize, _img, marginSize, borderBits);
}
......@@ -1562,7 +1562,7 @@ void drawPlanarBoard(Ptr<Board> &_board, Size outSize, OutputArray _img, int mar
/**
*/
double calibrateCameraAruco(InputArrayOfArrays _corners, InputArray _ids, InputArray _counter,
Ptr<Board> &board, Size imageSize, InputOutputArray _cameraMatrix,
const Ptr<Board> &board, Size imageSize, InputOutputArray _cameraMatrix,
InputOutputArray _distCoeffs, OutputArrayOfArrays _rvecs,
OutputArrayOfArrays _tvecs, int flags, TermCriteria criteria) {
......
......@@ -121,7 +121,7 @@ void CharucoBoard::draw(Size outSize, OutputArray _img, int marginSize, int bord
/**
*/
Ptr<CharucoBoard> CharucoBoard::create(int squaresX, int squaresY, float squareLength,
float markerLength, Ptr<Dictionary> &dictionary) {
float markerLength, const Ptr<Dictionary> &dictionary) {
CV_Assert(squaresX > 1 && squaresY > 1 && markerLength > 0 && squareLength > markerLength);
Ptr<CharucoBoard> res = makePtr<CharucoBoard>();
......@@ -230,7 +230,7 @@ void CharucoBoard::_getNearestMarkerCorners() {
/**
* Remove charuco corners if any of their minMarkers closest markers has not been detected
*/
static unsigned int _filterCornersWithoutMinMarkers(Ptr<CharucoBoard> &_board,
static unsigned int _filterCornersWithoutMinMarkers(const Ptr<CharucoBoard> &_board,
InputArray _allCharucoCorners,
InputArray _allCharucoIds,
InputArray _allArucoIds, int minMarkers,
......@@ -399,7 +399,7 @@ static unsigned int _selectAndRefineChessboardCorners(InputArray _allCorners, In
* distance to their closest markers
*/
static void _getMaximumSubPixWindowSizes(InputArrayOfArrays markerCorners, InputArray markerIds,
InputArray charucoCorners, Ptr<CharucoBoard> &board,
InputArray charucoCorners, const Ptr<CharucoBoard> &board,
vector< Size > &sizes) {
unsigned int nCharucoCorners = (unsigned int)charucoCorners.getMat().total();
......@@ -453,7 +453,7 @@ static void _getMaximumSubPixWindowSizes(InputArrayOfArrays markerCorners, Input
*/
static int _interpolateCornersCharucoApproxCalib(InputArrayOfArrays _markerCorners,
InputArray _markerIds, InputArray _image,
Ptr<CharucoBoard> &_board,
const Ptr<CharucoBoard> &_board,
InputArray _cameraMatrix, InputArray _distCoeffs,
OutputArray _charucoCorners,
OutputArray _charucoIds) {
......@@ -504,7 +504,7 @@ static int _interpolateCornersCharucoApproxCalib(InputArrayOfArrays _markerCorne
*/
static int _interpolateCornersCharucoLocalHom(InputArrayOfArrays _markerCorners,
InputArray _markerIds, InputArray _image,
Ptr<CharucoBoard> &_board,
const Ptr<CharucoBoard> &_board,
OutputArray _charucoCorners,
OutputArray _charucoIds) {
......@@ -592,7 +592,7 @@ static int _interpolateCornersCharucoLocalHom(InputArrayOfArrays _markerCorners,
/**
*/
int interpolateCornersCharuco(InputArrayOfArrays _markerCorners, InputArray _markerIds,
InputArray _image, Ptr<CharucoBoard> &_board,
InputArray _image, const Ptr<CharucoBoard> &_board,
OutputArray _charucoCorners, OutputArray _charucoIds,
InputArray _cameraMatrix, InputArray _distCoeffs) {
......@@ -681,7 +681,7 @@ static bool _arePointsEnoughForPoseEstimation(const vector< Point3f > &points) {
/**
*/
bool estimatePoseCharucoBoard(InputArray _charucoCorners, InputArray _charucoIds,
Ptr<CharucoBoard> &_board, InputArray _cameraMatrix, InputArray _distCoeffs,
const Ptr<CharucoBoard> &_board, InputArray _cameraMatrix, InputArray _distCoeffs,
OutputArray _rvec, OutputArray _tvec) {
CV_Assert((_charucoCorners.getMat().total() == _charucoIds.getMat().total()));
......@@ -711,7 +711,7 @@ bool estimatePoseCharucoBoard(InputArray _charucoCorners, InputArray _charucoIds
/**
*/
double calibrateCameraCharuco(InputArrayOfArrays _charucoCorners, InputArrayOfArrays _charucoIds,
Ptr<CharucoBoard> &_board, Size imageSize,
const Ptr<CharucoBoard> &_board, Size imageSize,
InputOutputArray _cameraMatrix, InputOutputArray _distCoeffs,
OutputArrayOfArrays _rvecs, OutputArrayOfArrays _tvecs, int flags,
TermCriteria criteria) {
......@@ -881,7 +881,7 @@ void detectCharucoDiamond(InputArray _image, InputArrayOfArrays _markerCorners,
/**
*/
void drawCharucoDiamond(Ptr<Dictionary> &dictionary, Vec4i ids, int squareLength, int markerLength,
void drawCharucoDiamond(const Ptr<Dictionary> &dictionary, Vec4i ids, int squareLength, int markerLength,
OutputArray _img, int marginSize, int borderBits) {
CV_Assert(squareLength > 0 && markerLength > 0 && squareLength > markerLength);
......
......@@ -70,7 +70,7 @@ Dictionary::Dictionary(const Mat &_bytesList, int _markerSize, int _maxcorr) {
/**
*/
Ptr<Dictionary> Dictionary::create(int nMarkers, int markerSize) {
Ptr<Dictionary> baseDictionary = makePtr<Dictionary>();
const Ptr<Dictionary> baseDictionary = makePtr<Dictionary>();
return create(nMarkers, markerSize, baseDictionary);
}
......@@ -78,7 +78,7 @@ Ptr<Dictionary> Dictionary::create(int nMarkers, int markerSize) {
/**
*/
Ptr<Dictionary> Dictionary::create(int nMarkers, int markerSize,
Ptr<Dictionary> &baseDictionary) {
const Ptr<Dictionary> &baseDictionary) {
return generateCustomDictionary(nMarkers, markerSize, baseDictionary);
}
......@@ -377,7 +377,7 @@ static int _getSelfDistance(const Mat &marker) {
/**
*/
Ptr<Dictionary> generateCustomDictionary(int nMarkers, int markerSize,
Ptr<Dictionary> &baseDictionary) {
const Ptr<Dictionary> &baseDictionary) {
Ptr<Dictionary> out = makePtr<Dictionary>();
out->markerSize = markerSize;
......
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