Main class for marker detection. More...
#include <markerdetector.h>
Classes | |
struct | Params |
Public Types | |
enum | ThresMethod : int { THRES_ADAPTIVE = 0, THRES_AUTO_FIXED = 1 } |
Public Member Functions | |
void | cornerUpsample (std::vector< Marker > &corners, cv::Size lowResImageSize) |
void | cornerUpsample (std::vector< std::vector< cv::Point2f > > &corners, cv::Size lowResImageSize) |
std::vector< aruco::Marker > | detect (const cv::Mat &input) |
std::vector< aruco::Marker > | detect (const cv::Mat &input, const CameraParameters &camParams, float markerSizeMeters, bool setYPerperdicular=false, bool correctFisheye=false) |
void | detect (const cv::Mat &input, std::vector< Marker > &detectedMarkers, CameraParameters camParams, float markerSizeMeters=-1, bool setYPerperdicular=false, bool correctFisheye=false) |
void | detect (const cv::Mat &input, std::vector< Marker > &detectedMarkers, cv::Mat camMatrix=cv::Mat(), cv::Mat distCoeff=cv::Mat(), cv::Mat extrinsics=cv::Mat(), float markerSizeMeters=-1, bool setYPerperdicular=false, bool correctFisheye=false) |
void | fromStream (std::istream &str) |
std::vector< MarkerCandidate > | getCandidates () const |
DetectionMode | getDetectionMode () |
std::vector< cv::Mat > | getImagePyramid () |
cv::Ptr< MarkerLabeler > | getMarkerLabeler () |
Params & | getParameters () |
Params | getParameters () const |
cv::Mat | getThresholdedImage (uint32_t idx=0) |
void | loadParamsFromFile (const std::string &path) |
MarkerDetector () | |
MarkerDetector (int dict_type, float error_correction_rate=0) | |
MarkerDetector (std::string dict_type, float error_correction_rate=0) | |
void | saveParamsToFile (const std::string &path) const |
void | setDetectionMode (DetectionMode dm, float minMarkerSize=0) |
void | setDictionary (int dict_type, float error_correction_rate=0) |
setDictionary Specifies the dictionary you want to use for marker decoding More... | |
void | setDictionary (std::string dict_type, float error_correction_rate=0) |
void | setMarkerLabeler (cv::Ptr< MarkerLabeler > detector) |
setMakerLabeler sets the labeler employed to analyze the squares and extract the inner binary code More... | |
void | setParameters (const Params ¶ms) |
void | toStream (std::ostream &str) const |
bool | warp (cv::Mat &in, cv::Mat &out, cv::Size size, std::vector< cv::Point2f > points) |
~MarkerDetector () | |
Private Attributes | |
MarkerDetector_Impl * | _impl |
Friends | |
class | MarkerDetector_Impl |
Main class for marker detection.
Definition at line 91 of file markerdetector.h.
enum aruco::MarkerDetector::ThresMethod : int |
Enumerator | |
---|---|
THRES_ADAPTIVE | |
THRES_AUTO_FIXED |
Definition at line 96 of file markerdetector.h.
aruco::MarkerDetector::MarkerDetector | ( | ) |
See
Definition at line 49 of file markerdetector.cpp.
aruco::MarkerDetector::MarkerDetector | ( | int | dict_type, |
float | error_correction_rate = 0 |
||
) |
Creates indicating the dictionary. See
dict_type | Dictionary employed. See |
error_correction_rate | value indicating the correction error allowed. Is in range [0,1]. 0 means no correction at all. So an erroneous bit will result in discarding the marker. 1, mean full correction. The maximum number of bits that can be corrected depends on each ditionary. We recommend using values from 0 to 0.5. (in general, this will allow up to 3 bits or correction). |
Definition at line 60 of file markerdetector.cpp.
aruco::MarkerDetector::MarkerDetector | ( | std::string | dict_type, |
float | error_correction_rate = 0 |
||
) |
Definition at line 72 of file markerdetector.cpp.
aruco::MarkerDetector::~MarkerDetector | ( | ) |
Definition at line 85 of file markerdetector.cpp.
void aruco::MarkerDetector::cornerUpsample | ( | std::vector< Marker > & | corners, |
cv::Size | lowResImageSize | ||
) |
void aruco::MarkerDetector::cornerUpsample | ( | std::vector< std::vector< cv::Point2f > > & | corners, |
cv::Size | lowResImageSize | ||
) |
Definition at line 456 of file markerdetector.cpp.
std::vector< aruco::Marker > aruco::MarkerDetector::detect | ( | const cv::Mat & | input | ) |
Detects the markers in the image passed
If you provide information about the camera parameters and the size of the marker, then, the extrinsics of the markers are detected
input | input color image |
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. If not specified this value, the extrinsics of the markers are not detected. |
setYPerperdicular | If set the Y axis will be perpendicular to the surface. Otherwise, it will be the Z axis |
correctFisheye | Correct fisheye distortion |
Definition at line 120 of file markerdetector.cpp.
std::vector< aruco::Marker > aruco::MarkerDetector::detect | ( | const cv::Mat & | input, |
const CameraParameters & | camParams, | ||
float | markerSizeMeters, | ||
bool | setYPerperdicular = false , |
||
bool | correctFisheye = false |
||
) |
Definition at line 125 of file markerdetector.cpp.
void aruco::MarkerDetector::detect | ( | const cv::Mat & | input, |
std::vector< Marker > & | detectedMarkers, | ||
CameraParameters | camParams, | ||
float | markerSizeMeters = -1 , |
||
bool | setYPerperdicular = false , |
||
bool | correctFisheye = false |
||
) |
Detects the markers in the image passed
If you provide information about the camera parameters and the size of the marker, then, the extrinsics of the markers are detected
input | input color image |
detectedMarkers | output vector with the markers detected |
camParams | Camera parameters |
markerSizeMeters | size of the marker sides expressed in meters |
setYPerperdicular | If set the Y axis will be perpendicular to the surface. Otherwise, it will be the Z axis |
correctFisheye | Correct fisheye distortion |
Definition at line 139 of file markerdetector.cpp.
void aruco::MarkerDetector::detect | ( | const cv::Mat & | input, |
std::vector< Marker > & | detectedMarkers, | ||
cv::Mat | camMatrix = cv::Mat() , |
||
cv::Mat | distCoeff = cv::Mat() , |
||
cv::Mat | extrinsics = cv::Mat() , |
||
float | markerSizeMeters = -1 , |
||
bool | setYPerperdicular = false , |
||
bool | correctFisheye = false |
||
) |
Detects the markers in the image passed
If you provide information about the camera parameters and the size of the marker, then, the extrinsics of the markers are detected
NOTE: be sure that the camera matrix is for this image size. If you do not know what I am talking about, use functions above and not this one
input | input color image |
detectedMarkers | output vector with the markers detected |
camMatrix | intrinsic camera information. |
distCoeff | camera distortion coefficient. If set Mat() if is assumed no camera distortion |
extrinsics | translation (tx,ty,tz) from right stereo camera to left. Empty if no stereo or left camera |
markerSizeMeters | size of the marker sides expressed in meters |
setYPerperdicular | If set the Y axis will be perpendicular to the surface. Otherwise, it will be the Z axis |
correctFisheye | Correct fisheye distortion |
void aruco::MarkerDetector::fromStream | ( | std::istream & | str | ) |
Definition at line 328 of file markerdetector.cpp.
std::vector< MarkerCandidate > aruco::MarkerDetector::getCandidates | ( | ) | const |
Returns a list candidates to be markers (rectangles), for which no valid id was found after calling detectRectangles
Definition at line 159 of file markerdetector.cpp.
DetectionMode aruco::MarkerDetector::getDetectionMode | ( | ) |
returns current detection mode
Definition at line 106 of file markerdetector.cpp.
std::vector< cv::Mat > aruco::MarkerDetector::getImagePyramid | ( | ) |
Definition at line 164 of file markerdetector.cpp.
cv::Ptr< MarkerLabeler > aruco::MarkerDetector::getMarkerLabeler | ( | ) |
Definition at line 168 of file markerdetector.cpp.
Params& aruco::MarkerDetector::getParameters | ( | ) |
Returns operating params
MarkerDetector::Params & aruco::MarkerDetector::getParameters | ( | ) | const |
Returns operating params
Definition at line 148 of file markerdetector.cpp.
cv::Mat aruco::MarkerDetector::getThresholdedImage | ( | uint32_t | idx = 0 | ) |
Returns a reference to the internal image thresholded. Since there can be generated many of them, specify which
Definition at line 187 of file markerdetector.cpp.
void aruco::MarkerDetector::loadParamsFromFile | ( | const std::string & | path | ) |
Loads the configuration from a file.
Loads the configuration from a file
Definition at line 318 of file markerdetector.cpp.
void aruco::MarkerDetector::saveParamsToFile | ( | const std::string & | path | ) | const |
Saves the configuration of the detector to a file.
Saves the configuration of the detector to a file
Definition at line 311 of file markerdetector.cpp.
void aruco::MarkerDetector::setDetectionMode | ( | DetectionMode | dm, |
float | minMarkerSize = 0 |
||
) |
Specifies the detection mode. We have preset three types of detection modes. These are ways to configure the internal parameters for the most typical situations. The modes are:
Definition at line 101 of file markerdetector.cpp.
void aruco::MarkerDetector::setDictionary | ( | int | dict_type, |
float | error_correction_rate = 0 |
||
) |
setDictionary Specifies the dictionary you want to use for marker decoding
dict_type | dictionary employed for decoding markers |
error_correction_rate | value indicating the correction error allowed. Is in range [0,1]. 0 means no correction at all. So an erroneous bit will result in discarding the marker. 1, mean full correction. The maximum number of bits that can be corrected depends on each ditionary. We recommend using values from 0 to 0.5. (in general, this will allow up to 3 bits or correction). |
Definition at line 177 of file markerdetector.cpp.
void aruco::MarkerDetector::setDictionary | ( | std::string | dict_type, |
float | error_correction_rate = 0 |
||
) |
Sets the dictionary to be employed. You can choose:ARUCO,//original aruco dictionary. By default ARUCO_MIP_25h7, ARUCO_MIP_16h3, ARUCO_MIP_36h12, **** recommended ARTAG,// ARTOOLKITPLUS, ARTOOLKITPLUSBCH,// TAG16h5,TAG25h7,TAG25h9,TAG36h11,TAG36h10//APRIL TAGS DICIONARIES CHILITAGS,//chili tags dictionary . NOT RECOMMENDED. It has distance 0. Markers 806 and 682 should not be used!!!
If dict_type is none of the above ones, it is assumed you mean a CUSTOM dicionary saved in a file
void aruco::MarkerDetector::setMarkerLabeler | ( | cv::Ptr< MarkerLabeler > | detector | ) |
setMakerLabeler sets the labeler employed to analyze the squares and extract the inner binary code
returns the number of thresholed images available
Methods you may not need
detector |
Definition at line 172 of file markerdetector.cpp.
void aruco::MarkerDetector::setParameters | ( | const Params & | params | ) |
Definition at line 90 of file markerdetector.cpp.
void aruco::MarkerDetector::toStream | ( | std::ostream & | str | ) | const |
Definition at line 323 of file markerdetector.cpp.
bool aruco::MarkerDetector::warp | ( | cv::Mat & | in, |
cv::Mat & | out, | ||
cv::Size | size, | ||
std::vector< cv::Point2f > | points | ||
) |
Given the iput image with markers, creates an output image with it in the canonical position
in | input image |
out | image with the marker |
size | of out |
points | 4 corners of the marker in the image in |
|
friend |
Definition at line 93 of file markerdetector.h.
|
private |
Definition at line 460 of file markerdetector.h.