Commit b2e68454 authored by sht3ch's avatar sht3ch Committed by Vladislav Sovrasov

Added extra method to Board::create() to provide raw interface to python

parent ba1d3ef9
......@@ -226,6 +226,15 @@ CV_EXPORTS_W void estimatePoseSingleMarkers(InputArrayOfArrays corners, float ma
class CV_EXPORTS_W Board {
public:
/**
* @brief Provide way to create Board by passing nessesary data. Specially needed in Python.
*
* @param objPoints array of object points of all the marker corners in the board
* @param dictionary the dictionary of markers employed for this board
* @param ids vector of the identifiers of the markers in the board
*
*/
CV_WRAP static Ptr<Board> create(InputArrayOfArrays objPoints, Ptr<Dictionary> &dictionary, InputArray ids);
// array of object points of all the marker corners in the board
// each marker include its 4 corners, i.e. for M markers, the size is Mx4
CV_PROP std::vector< std::vector< Point3f > > objPoints;
......
......@@ -41,7 +41,6 @@ the use of this software, even if advised of the possibility of such damage.
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
namespace cv {
namespace aruco {
......@@ -1329,6 +1328,30 @@ void GridBoard::draw(Size outSize, OutputArray _img, int marginSize, int borderB
}
/**
*/
Ptr<Board> Board::create(InputArrayOfArrays objPoints, Ptr<Dictionary> &dictionary, InputArray ids) {
CV_Assert(objPoints.total() == ids.total());
CV_Assert(objPoints.type() == CV_32FC3);
std::vector< std::vector< Point3f > > obj_points_vector;
for (unsigned int i = 0; i < objPoints.total(); i++) {
std::vector<Point3f> corners;
Mat corners_mat = objPoints.getMat(i);
for (int j = 0; j < 4; j++) {
corners.push_back(corners_mat.at<Point3f>(j));
}
obj_points_vector.push_back(corners);
}
Ptr<Board> res = makePtr<Board>();
ids.copyTo(res->ids);
res->objPoints = obj_points_vector;
res->dictionary = dictionary;
return res;
}
/**
*/
Ptr<GridBoard> GridBoard::create(int markersX, int markersY, float markerLength, float markerSeparation,
......
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