Class cv::aruco::ArucoDetector#

The main functionality of ArucoDetector class is detection of markers in an image with detectMarkers() method. View details

Collaboration diagram for cv::aruco::ArucoDetector:

Public Member Functions#

Public Member Functions inherited from cv::Algorithm

Return

Name

Description

Algorithm()

~Algorithm()

void

clear()

Clears the algorithm state.

bool

empty()

Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.

String

getDefaultName()

void

read(const FileNode & fn)

Reads algorithm parameters from a file storage.

void

save(const String & filename)

void

write(
    const Ptr< FileStorage > & fs,
    const String & name = String() )

void

write(FileStorage & fs)

Stores algorithm parameters in a file storage.

void

write(
    FileStorage & fs,
    const String & name )

Static Public Member Functions#

Static Public Member Functions inherited from cv::Algorithm

Return

Name

Description

static Ptr< _Tp >

load(
    const String & filename,
    const String & objname = String() )

Loads algorithm from the file.

static Ptr< _Tp >

loadFromString(
    const String & strModel,
    const String & objname = String() )

Loads algorithm from a String.

static Ptr< _Tp >

read(const FileNode & fn)

Reads algorithm from the file node.

Additional Inherited Members#

Protected Member Functions inherited from cv::Algorithm

Return

Name

Description

void

writeFormat(FileStorage & fs)

Detailed Description#

The main functionality of ArucoDetector class is detection of markers in an image with detectMarkers() method.

After detecting some markers in the image, you can try to find undetected markers from this dictionary with refineDetectedMarkers() method.

See also

DetectorParameters, RefineParameters

Constructor & Destructor Documentation#

ArucoDetector()#

cv::aruco::ArucoDetector::ArucoDetector(
const Dictionary & dictionary = getPredefinedDictionary(cv::aruco::DICT_4X4_50),
const DetectorParameters & detectorParams = DetectorParameters(),
const RefineParameters & refineParams = RefineParameters() )

Python:

cv.aruco.ArucoDetector([, dictionary[, detectorParams[, refineParams]]]) -> <aruco_ArucoDetector object>
cv.aruco.ArucoDetector(dictionaries[, detectorParams[, refineParams]]) -> <aruco_ArucoDetector object>

Basic ArucoDetector constructor.

Parameters

  • dictionary — indicates the type of markers that will be searched

  • detectorParams — marker detection parameters

  • refineParams — marker refine detection parameters

Here is the call graph for this function:

cv::aruco::ArucoDetector::ArucoDetector Node1 cv::aruco::ArucoDetector ::ArucoDetector Node2 cv::aruco::getPredefined Dictionary Node1->Node2

cv::aruco::ArucoDetector::ArucoDetector Node1 cv::aruco::ArucoDetector ::ArucoDetector Node2 cv::aruco::getPredefined Dictionary Node1->Node2

ArucoDetector()#

cv::aruco::ArucoDetector::ArucoDetector(
const std::vector< Dictionary > & dictionaries,
const DetectorParameters & detectorParams = DetectorParameters(),
const RefineParameters & refineParams = RefineParameters() )

Python:

cv.aruco.ArucoDetector([, dictionary[, detectorParams[, refineParams]]]) -> <aruco_ArucoDetector object>
cv.aruco.ArucoDetector(dictionaries[, detectorParams[, refineParams]]) -> <aruco_ArucoDetector object>

ArucoDetector constructor for multiple dictionaries.

Parameters

  • dictionaries — indicates the type of markers that will be searched. Empty dictionaries will throw an error.

  • detectorParams — marker detection parameters

  • refineParams — marker refine detection parameters

Member Function Documentation#

detectMarkers()#

void cv::aruco::ArucoDetector::detectMarkers(
InputArray image,
OutputArrayOfArrays corners,
OutputArray ids,
OutputArrayOfArrays rejectedImgPoints = noArray() )

Python:

cv.aruco.ArucoDetector.detectMarkers(image[, corners[, ids[, rejectedImgPoints]]]) -> corners, ids, rejectedImgPoints

Basic marker detection.

Performs marker detection in the input image. Only markers included in the first specified dictionary are searched. For each detected marker, it returns the 2D position of its corner in the image and its corresponding identifier. Note that this function does not perform pose estimation.

Note

The function does not correct lens distortion or takes it into account. It’s recommended to undistort input image with corresponding camera model, if camera parameters are known

See also

undistort, estimatePoseSingleMarkers, estimatePoseBoard

Parameters

  • image — input image

  • corners — vector of detected marker corners. For each marker, its four corners are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.

  • ids — vector of identifiers of the detected markers. The identifier is of type int (e.g. std::vector). For N detected markers, the size of ids is also N. The identifiers have the same order than the markers in the imgPoints array.

  • rejectedImgPoints — contains the imgPoints of those squares whose inner code has not a correct codification. Useful for debugging purposes.

Here is the call graph for this function:

cv::aruco::ArucoDetector::detectMarkers Node1 cv::aruco::ArucoDetector ::detectMarkers Node2 cv::noArray Node1->Node2

cv::aruco::ArucoDetector::detectMarkers Node1 cv::aruco::ArucoDetector ::detectMarkers Node2 cv::noArray Node1->Node2

detectMarkersMultiDict()#

void cv::aruco::ArucoDetector::detectMarkersMultiDict(
InputArray image,
OutputArrayOfArrays corners,
OutputArray ids,
OutputArrayOfArrays rejectedImgPoints = noArray(),
OutputArray dictIndices = noArray() )

Python:

cv.aruco.ArucoDetector.detectMarkersMultiDict(image[, corners[, ids[, rejectedImgPoints[, dictIndices]]]]) -> corners, ids, rejectedImgPoints, dictIndices

Basic marker detection.

Performs marker detection in the input image. Only markers included in the specific dictionaries are searched. For each detected marker, it returns the 2D position of its corner in the image and its corresponding identifier. Note that this function does not perform pose estimation.

Note

The function does not correct lens distortion or takes it into account. It’s recommended to undistort input image with corresponding camera model, if camera parameters are known

See also

undistort, estimatePoseSingleMarkers, estimatePoseBoard

Parameters

  • image — input image

  • corners — vector of detected marker corners. For each marker, its four corners are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.

  • ids — vector of identifiers of the detected markers. The identifier is of type int (e.g. std::vector). For N detected markers, the size of ids is also N. The identifiers have the same order than the markers in the imgPoints array.

  • rejectedImgPoints — contains the imgPoints of those squares whose inner code has not a correct codification. Useful for debugging purposes.

  • dictIndices — vector of dictionary indices for each detected marker. Use getDictionaries() to get the list of corresponding dictionaries.

Here is the call graph for this function:

cv::aruco::ArucoDetector::detectMarkersMultiDict Node1 cv::aruco::ArucoDetector ::detectMarkersMultiDict Node2 cv::noArray Node1->Node2

cv::aruco::ArucoDetector::detectMarkersMultiDict Node1 cv::aruco::ArucoDetector ::detectMarkersMultiDict Node2 cv::noArray Node1->Node2

detectMarkersWithConfidence()#

void cv::aruco::ArucoDetector::detectMarkersWithConfidence(
InputArray image,
OutputArrayOfArrays corners,
OutputArray ids,
OutputArray markersConfidence,
OutputArrayOfArrays rejectedImgPoints = noArray() )

Python:

cv.aruco.ArucoDetector.detectMarkersWithConfidence(image[, corners[, ids[, markersConfidence[, rejectedImgPoints]]]]) -> corners, ids, markersConfidence, rejectedImgPoints

Marker detection with confidence computation.

Performs marker detection in the input image. Only markers included in the first specified dictionary are searched. For each detected marker, it returns the 2D position of its corner in the image and its corresponding identifier. Note that this function does not perform pose estimation.

Note

The function does not correct lens distortion or takes it into account. It’s recommended to undistort input image with corresponding camera model, if camera parameters are known

See also

undistort, estimatePoseSingleMarkers, estimatePoseBoard

Parameters

  • image — input image

  • corners — vector of detected marker corners. For each marker, its four corners are provided, (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.

  • ids — vector of identifiers of the detected markers. The identifier is of type int (e.g. std::vector). For N detected markers, the size of ids is also N. The identifiers have the same order than the markers in the imgPoints array.

  • markersConfidence — contains the normalized confidence [0;1] of the markers’ detection, defined as 1 minus the normalized uncertainty (percentage of incorrect pixel detections), with 1 describing a pixel perfect detection. The confidence values are of type float (e.g. std::vector)

  • rejectedImgPoints — contains the imgPoints of those squares whose inner code has not a correct codification. Useful for debugging purposes.

Here is the call graph for this function:

cv::aruco::ArucoDetector::detectMarkersWithConfidence Node1 cv::aruco::ArucoDetector ::detectMarkersWithConfidence Node2 cv::noArray Node1->Node2

cv::aruco::ArucoDetector::detectMarkersWithConfidence Node1 cv::aruco::ArucoDetector ::detectMarkersWithConfidence Node2 cv::noArray Node1->Node2

getDetectorParameters()#

const DetectorParameters & cv::aruco::ArucoDetector::getDetectorParameters()

Python:

cv.aruco.ArucoDetector.getDetectorParameters() -> retval

getDictionaries()#

std::vector< Dictionary > cv::aruco::ArucoDetector::getDictionaries()

Python:

cv.aruco.ArucoDetector.getDictionaries() -> retval

Returns all dictionaries currently used for marker detection as a vector.

Returns

A std::vector containing all dictionaries used by the ArucoDetector.

getDictionary()#

const Dictionary & cv::aruco::ArucoDetector::getDictionary()

Python:

cv.aruco.ArucoDetector.getDictionary() -> retval

Returns first dictionary from internal list used for marker detection.

Returns

The first dictionary from the configured ArucoDetector.

getRefineParameters()#

const RefineParameters & cv::aruco::ArucoDetector::getRefineParameters()

Python:

cv.aruco.ArucoDetector.getRefineParameters() -> retval

read()#

void cv::aruco::ArucoDetector::read(const FileNode & fn)

Python:

cv.aruco.ArucoDetector.read(fn)

Reads algorithm parameters from a file storage.

refineDetectedMarkers()#

void cv::aruco::ArucoDetector::refineDetectedMarkers(
InputArray image,
const Board & board,
InputOutputArrayOfArrays detectedCorners,
InputOutputArray detectedIds,
InputOutputArrayOfArrays rejectedCorners,
InputArray cameraMatrix = noArray(),
InputArray distCoeffs = noArray(),
OutputArray recoveredIdxs = noArray() )

Python:

cv.aruco.ArucoDetector.refineDetectedMarkers(image, board, detectedCorners, detectedIds, rejectedCorners[, cameraMatrix[, distCoeffs[, recoveredIdxs]]]) -> detectedCorners, detectedIds, rejectedCorners, recoveredIdxs

Refine not detected markers based on the already detected and the board layout.

This function tries to find markers that were not detected in the basic detecMarkers function. First, based on the current detected marker and the board layout, the function interpolates the position of the missing markers. Then it tries to find correspondence between the reprojected markers and the rejected candidates based on the minRepDistance and errorCorrectionRate parameters. If camera parameters and distortion coefficients are provided, missing markers are reprojected using projectPoint function. If not, missing marker projections are interpolated using global homography, and all the marker corners in the board must have the same Z coordinate.

Note

This function assumes that the board only contains markers from one dictionary, so only the first configured dictionary is used. It has to match the dictionary of the board to work properly.

Parameters

  • image — input image

  • board — layout of markers in the board.

  • detectedCorners — vector of already detected marker corners.

  • detectedIds — vector of already detected marker identifiers.

  • rejectedCorners — vector of rejected candidates during the marker detection process.

  • cameraMatrix — optional input 3x3 floating-point camera matrix \(A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\)

  • distCoeffs — optional vector of distortion coefficients \((k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\) of 4, 5, 8 or 12 elements

  • recoveredIdxs — Optional array to returns the indexes of the recovered candidates in the original rejectedCorners array.

Here is the call graph for this function:

cv::aruco::ArucoDetector::refineDetectedMarkers Node1 cv::aruco::ArucoDetector ::refineDetectedMarkers Node2 cv::noArray Node1->Node2

cv::aruco::ArucoDetector::refineDetectedMarkers Node1 cv::aruco::ArucoDetector ::refineDetectedMarkers Node2 cv::noArray Node1->Node2

setDetectorParameters()#

void cv::aruco::ArucoDetector::setDetectorParameters(const DetectorParameters & detectorParameters)

Python:

cv.aruco.ArucoDetector.setDetectorParameters(detectorParameters)

setDictionaries()#

void cv::aruco::ArucoDetector::setDictionaries(const std::vector< Dictionary > & dictionaries)

Python:

cv.aruco.ArucoDetector.setDictionaries(dictionaries)

Sets the entire collection of dictionaries to be used for marker detection, replacing any existing dictionaries.

Configures the ArucoDetector to use the provided vector of dictionaries for marker detection. This method replaces any dictionaries that were previously set.

Note

Setting an empty vector of dictionaries will throw an error.

Parameters

  • dictionaries — A std::vector containing the new set of dictionaries to be used.

setDictionary()#

void cv::aruco::ArucoDetector::setDictionary(const Dictionary & dictionary)

Python:

cv.aruco.ArucoDetector.setDictionary(dictionary)

Sets and replaces the first dictionary in internal list to be used for marker detection.

Parameters

  • dictionary — The new dictionary that will replace the first dictionary in the internal list.

setRefineParameters()#

void cv::aruco::ArucoDetector::setRefineParameters(const RefineParameters & refineParameters)

Python:

cv.aruco.ArucoDetector.setRefineParameters(refineParameters)

write()#

void cv::aruco::ArucoDetector::write(FileStorage & fs)

Python:

cv.aruco.ArucoDetector.write(fs, name)

Stores algorithm parameters in a file storage.

write()#

void cv::aruco::ArucoDetector::write(
FileStorage & fs,
const String & name )

Python:

cv.aruco.ArucoDetector.write(fs, name)

simplified API for language bindings

Member Data Documentation#

arucoDetectorImpl#

Ptr< ArucoDetectorImpl > cv::aruco::ArucoDetector::arucoDetectorImpl

Source file#

The documentation for this class was generated from the following file: