This class detects AR boards Version 1.2 There are two modes for board detection. First, the old way. (You first detect markers with MarkerDetector and then call to detect in this class. More...
#include <boarddetector.h>
Public Member Functions | |
BoardDetector (bool setYPerpendicular=false) | |
float | detect (const cv::Mat &im) throw (cv::Exception) |
float | detect (const vector< Marker > &detectedMarkers, const BoardConfiguration &BConf, Board &Bdetected, cv::Mat camMatrix=cv::Mat(), cv::Mat distCoeff=cv::Mat(), float markerSizeMeters=-1) throw (cv::Exception) |
float | detect (const vector< Marker > &detectedMarkers, const BoardConfiguration &BConf, Board &Bdetected, const CameraParameters &cp, float markerSizeMeters=-1) throw (cv::Exception) |
float | get_repj_err_thres () const |
Board & | getDetectedBoard () |
vector< Marker > & | getDetectedMarkers () |
MarkerDetector & | getMarkerDetector () |
bool | isYPerpendicular () |
void | set_repj_err_thres (float Repj_err_thres) |
void | setParams (const BoardConfiguration &bc, const CameraParameters &cp, float markerSizeMeters=-1) |
void | setParams (const BoardConfiguration &bc) |
void | setYPerpendicular (bool enable) |
void | setYPerperdicular (bool enable) |
Static Public Member Functions | |
static Board | detect (const cv::Mat &Image, const BoardConfiguration &bc, const CameraParameters &cp, float markerSizeMeters=-1) |
Private Member Functions | |
void | rotateXAxis (cv::Mat &rotation) |
Private Attributes | |
bool | _areParamsSet |
BoardConfiguration | _bconf |
Board | _boardDetected |
CameraParameters | _camParams |
float | _markerSize |
MarkerDetector | _mdetector |
bool | _setYPerpendicular |
vector< Marker > | _vmarkers |
float | repj_err_thres |
This class detects AR boards Version 1.2 There are two modes for board detection. First, the old way. (You first detect markers with MarkerDetector and then call to detect in this class.
Second: New mode, marker detection is included in the class
CameraParameters CP; CP.readFromFile(path_cp) BoardConfiguration BC; BC.readFromFile(path_bc); BoardDetector BD; BD.setParams(BC,CP); //or only BD.setParams(BC) //capture image cv::Mat im; capture_image(im); float prob=BD.detect(im); if (prob>0.3) CvDrawingUtils::draw3DAxis(im,BD.getDetectedBoard(),CP);
Definition at line 65 of file boarddetector.h.
aruco::BoardDetector::BoardDetector | ( | bool | setYPerpendicular = false | ) |
See discussion in
Definition at line 41 of file boarddetector.cpp.
float aruco::BoardDetector::detect | ( | const cv::Mat & | im | ) | throw (cv::Exception) |
Detect markers, and then, look for the board indicated in setParams()
Definition at line 68 of file boarddetector.cpp.
float aruco::BoardDetector::detect | ( | const vector< Marker > & | detectedMarkers, |
const BoardConfiguration & | BConf, | ||
Board & | Bdetected, | ||
cv::Mat | camMatrix = cv::Mat() , |
||
cv::Mat | distCoeff = cv::Mat() , |
||
float | markerSizeMeters = -1 |
||
) | throw (cv::Exception) |
Given the markers detected, determines if there is the board passed
detectedMarkers | result provided by aruco::ArMarkerDetector |
BConf | the board you want to see if is present |
Bdetected | output information of the detected board |
camMatrix | camera matrix with intrinsics |
distCoeff | camera distorsion coeff |
camMatrix | intrinsic camera information. |
distCoeff | camera distorsion coefficient. If set Mat() if is assumed no camera distorion |
markerSizeMeters | size of the marker sides expressed in meters |
float aruco::BoardDetector::detect | ( | const vector< Marker > & | detectedMarkers, |
const BoardConfiguration & | BConf, | ||
Board & | Bdetected, | ||
const CameraParameters & | cp, | ||
float | markerSizeMeters = -1 |
||
) | throw (cv::Exception) |
Definition at line 82 of file boarddetector.cpp.
Board aruco::BoardDetector::detect | ( | const cv::Mat & | Image, |
const BoardConfiguration & | bc, | ||
const CameraParameters & | cp, | ||
float | markerSizeMeters = -1 |
||
) | [static] |
Static version (all in one). Detects the board indicated
Image | input image |
bc | the board you want to see if is present |
cp | camera parameters |
markerSizeMeters | size of the marker sides expressed in meters (not needed in the board is expressed in meters) |
Static version (all in one)
Definition at line 221 of file boarddetector.cpp.
float aruco::BoardDetector::get_repj_err_thres | ( | ) | const [inline] |
Definition at line 134 of file boarddetector.h.
Board& aruco::BoardDetector::getDetectedBoard | ( | ) | [inline] |
Returns a reference to the board detected
Definition at line 86 of file boarddetector.h.
vector<Marker>& aruco::BoardDetector::getDetectedMarkers | ( | ) | [inline] |
Returns the vector of markers detected
Definition at line 92 of file boarddetector.h.
MarkerDetector& aruco::BoardDetector::getMarkerDetector | ( | ) | [inline] |
Returns a reference to the internal marker detector
Definition at line 89 of file boarddetector.h.
bool aruco::BoardDetector::isYPerpendicular | ( | ) | [inline] |
Definition at line 127 of file boarddetector.h.
void aruco::BoardDetector::rotateXAxis | ( | cv::Mat & | rotation | ) | [private] |
Definition at line 202 of file boarddetector.cpp.
void aruco::BoardDetector::set_repj_err_thres | ( | float | Repj_err_thres | ) | [inline] |
Sets the threshold for reprjection test. Pixels that after estimating the camera location projects 'repj_err_thres' pixels farther from its original location are discarded as outliers. By default it is set to -1, meaning that not reprojection test is performed
Definition at line 133 of file boarddetector.h.
void aruco::BoardDetector::setParams | ( | const BoardConfiguration & | bc, |
const CameraParameters & | cp, | ||
float | markerSizeMeters = -1 |
||
) |
Use if you plan to let this class to perform marker detection too
Definition at line 49 of file boarddetector.cpp.
void aruco::BoardDetector::setParams | ( | const BoardConfiguration & | bc | ) |
Definition at line 59 of file boarddetector.cpp.
void aruco::BoardDetector::setYPerpendicular | ( | bool | enable | ) | [inline] |
By default, the Y axis is set to point up. However this is not the default operation mode of opencv, which produces the Z axis pointing up instead. So, to achieve this change, we have to rotate the X axis.
Definition at line 125 of file boarddetector.h.
void aruco::BoardDetector::setYPerperdicular | ( | bool | enable | ) | [inline] |
Definition at line 126 of file boarddetector.h.
bool aruco::BoardDetector::_areParamsSet [private] |
Definition at line 142 of file boarddetector.h.
Definition at line 143 of file boarddetector.h.
Board aruco::BoardDetector::_boardDetected [private] |
Definition at line 144 of file boarddetector.h.
Definition at line 146 of file boarddetector.h.
float aruco::BoardDetector::_markerSize [private] |
Definition at line 145 of file boarddetector.h.
Definition at line 147 of file boarddetector.h.
bool aruco::BoardDetector::_setYPerpendicular [private] |
Definition at line 139 of file boarddetector.h.
vector<Marker> aruco::BoardDetector::_vmarkers [private] |
Definition at line 148 of file boarddetector.h.
float aruco::BoardDetector::repj_err_thres [private] |
Definition at line 145 of file boarddetector.h.