aruco_ArucoDetector
import { aruco_ArucoDetector } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits Algorithm.
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: DetectorParameters, RefineParameters
Constructors and members
static new
Basic ArucoDetector constructor
new(dictionary: aruco_Dictionary, detectorParams: aruco_DetectorParameters, refineParams: aruco_RefineParameters): aruco_ArucoDetector;4 available overloads
new(): aruco_ArucoDetector;new(dictionary: aruco_Dictionary): aruco_ArucoDetector;new(dictionary: aruco_Dictionary, detectorParams: aruco_DetectorParameters): aruco_ArucoDetector;new(dictionary: aruco_Dictionary, detectorParams: aruco_DetectorParameters, refineParams: aruco_RefineParameters): aruco_ArucoDetector;dictionaryindicates the type of markers that will be searched
detectorParamsmarker detection parameters
refineParamsmarker refine detection parameters
The aruco_ArucoDetector result.
static from1
Create an owned aruco_ArucoDetector instance with the supplied configuration.
The main functionality of ArucoDetector class is detection of markers in an image with detectMarkers() method.
from1(_0: aruco__DictionaryVector, _1: aruco_DetectorParameters, _2: aruco_RefineParameters): aruco_ArucoDetector | null;3 available overloads
from1(_0: aruco__DictionaryVector): aruco_ArucoDetector | null;from1(_0: aruco__DictionaryVector, _1: aruco_DetectorParameters): aruco_ArucoDetector | null;from1(_0: aruco__DictionaryVector, _1: aruco_DetectorParameters, _2: aruco_RefineParameters): aruco_ArucoDetector | null;_00 argument (aruco__DictionaryVector).
_11 argument (aruco_DetectorParameters).
_22 argument (aruco_RefineParameters).
The aruco_ArucoDetector | null result.
clone
Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.
clone(): this;The this result.
detectMarkers
Basic marker detection
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: undistort, estimatePoseSingleMarkers, estimatePoseBoard
detectMarkers(image: Mat, corners: MatVector, ids: Mat, rejectedImgPoints: MatVector): void;2 available overloads
detectMarkers(image: Mat, corners: MatVector, ids: Mat): void;detectMarkers(image: Mat, corners: MatVector, ids: Mat, rejectedImgPoints: MatVector): void;imageinput image
cornersOutput destination, filled by the native operation. vector of detected marker corners. For each marker, its four corners are provided, (e.g std::vector<std::vectorcv::Point2f > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.
idsOutput destination, filled by the native operation. vector of identifiers of the detected markers. The identifier is of type int (e.g. std::vector<int>). For N detected markers, the size of ids is also N. The identifiers have the same order than the markers in the imgPoints array.
rejectedImgPointsOutput destination, filled by the native operation. contains the imgPoints of those squares whose inner code has not a correct codification. Useful for debugging purposes.
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.
detectMarkersWithConfidence
Marker detection with confidence computation
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: undistort, estimatePoseSingleMarkers, estimatePoseBoard
detectMarkersWithConfidence(image: Mat, corners: MatVector, ids: Mat, markersConfidence: Mat, rejectedImgPoints: MatVector): void;2 available overloads
detectMarkersWithConfidence(image: Mat, corners: MatVector, ids: Mat, markersConfidence: Mat): void;detectMarkersWithConfidence(image: Mat, corners: MatVector, ids: Mat, markersConfidence: Mat, rejectedImgPoints: MatVector): void;imageinput image
cornersOutput destination, filled by the native operation. vector of detected marker corners. For each marker, its four corners are provided, (e.g std::vector<std::vectorcv::Point2f > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.
idsOutput destination, filled by the native operation. vector of identifiers of the detected markers. The identifier is of type int (e.g. std::vector<int>). For N detected markers, the size of ids is also N. The identifiers have the same order than the markers in the imgPoints array.
markersConfidenceOutput destination, filled by the native operation. 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<float>)
rejectedImgPointsOutput destination, filled by the native operation. contains the imgPoints of those squares whose inner code has not a correct codification. Useful for debugging purposes.
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.
refineDetectedMarkers
Refine not detected markers based on the already detected and the board layout
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.
refineDetectedMarkers(image: Mat, board: aruco_Board, detectedCorners: MatVector, detectedIds: Mat, rejectedCorners: MatVector, cameraMatrix: Mat, distCoeffs: Mat, recoveredIdxs: Mat): void;4 available overloads
refineDetectedMarkers(image: Mat, board: aruco_Board, detectedCorners: MatVector, detectedIds: Mat, rejectedCorners: MatVector): void;refineDetectedMarkers(image: Mat, board: aruco_Board, detectedCorners: MatVector, detectedIds: Mat, rejectedCorners: MatVector, cameraMatrix: Mat): void;refineDetectedMarkers(image: Mat, board: aruco_Board, detectedCorners: MatVector, detectedIds: Mat, rejectedCorners: MatVector, cameraMatrix: Mat, distCoeffs: Mat): void;refineDetectedMarkers(image: Mat, board: aruco_Board, detectedCorners: MatVector, detectedIds: Mat, rejectedCorners: MatVector, cameraMatrix: Mat, distCoeffs: Mat, recoveredIdxs: Mat): void;imageinput image
boardlayout of markers in the board.
detectedCornersInput/output value, modified by the native operation. vector of already detected marker corners.
detectedIdsInput/output value, modified by the native operation. vector of already detected marker identifiers.
rejectedCornersInput/output value, modified by the native operation. vector of rejected candidates during the marker detection process.
cameraMatrixoptional input 3x3 floating-point camera matrix
A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}distCoeffsoptional 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 elementsrecoveredIdxsOutput destination, filled by the native operation. Optional array to returns the indexes of the recovered candidates in the original rejectedCorners array.
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.
detectMarkersMultiDict
Basic marker detection
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: undistort, estimatePoseSingleMarkers, estimatePoseBoard
detectMarkersMultiDict(image: Mat, corners: MatVector, ids: Mat, rejectedImgPoints: MatVector, dictIndices: Mat): void;3 available overloads
detectMarkersMultiDict(image: Mat, corners: MatVector, ids: Mat): void;detectMarkersMultiDict(image: Mat, corners: MatVector, ids: Mat, rejectedImgPoints: MatVector): void;detectMarkersMultiDict(image: Mat, corners: MatVector, ids: Mat, rejectedImgPoints: MatVector, dictIndices: Mat): void;imageinput image
cornersOutput destination, filled by the native operation. vector of detected marker corners. For each marker, its four corners are provided, (e.g std::vector<std::vectorcv::Point2f > ). For N detected markers, the dimensions of this array is Nx4. The order of the corners is clockwise.
idsOutput destination, filled by the native operation. vector of identifiers of the detected markers. The identifier is of type int (e.g. std::vector<int>). For N detected markers, the size of ids is also N. The identifiers have the same order than the markers in the imgPoints array.
rejectedImgPointsOutput destination, filled by the native operation. contains the imgPoints of those squares whose inner code has not a correct codification. Useful for debugging purposes.
dictIndicesOutput destination, filled by the native operation. vector of dictionary indices for each detected marker. Use getDictionaries() to get the list of corresponding dictionaries.
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.
getDictionaries
Returns all dictionaries currently used for marker detection as a vector.
getDictionaries(): aruco__DictionaryVector;A std::vector<Dictionary> containing all dictionaries used by the ArucoDetector. Release returned native handles with using or delete(), including handles nested in results.
setDictionaries
Sets the entire collection of dictionaries to be used for marker detection, replacing any existing dictionaries.
Note: Setting an empty vector of dictionaries will throw an error.
setDictionaries(dictionaries: aruco__DictionaryVector): void;dictionariesA std::vector<Dictionary> containing the new set of dictionaries to be used.
Configures the ArucoDetector to use the provided vector of dictionaries for marker detection. This method replaces any dictionaries that were previously set.
getDetectorParameters
Return the detector parameters configured on this aruco_ArucoDetector object.
getDetectorParameters(): aruco_DetectorParameters;The aruco_DetectorParameters result.
setDetectorParameters
Set the detector parameters used by this aruco_ArucoDetector object.
setDetectorParameters(detectorParameters: aruco_DetectorParameters): void;detectorParametersdetector parameters argument (aruco_DetectorParameters).
getRefineParameters
Return the refine parameters configured on this aruco_ArucoDetector object.
getRefineParameters(): aruco_RefineParameters;The aruco_RefineParameters result.
setRefineParameters
Set the refine parameters used by this aruco_ArucoDetector object.
setRefineParameters(refineParameters: aruco_RefineParameters): void;refineParametersrefine parameters argument (aruco_RefineParameters).
write
simplified API for language bindings
write(fs: FileStorage, name: EmbindString): void;fsfs argument (FileStorage).
namename argument (EmbindString).
read
Reads algorithm parameters from a file storage
read(fn: FileNode): void;fnfn argument (FileNode).
getDictionary
Returns first dictionary from internal list used for marker detection.
getDictionary(): aruco_Dictionary;The first dictionary from the configured ArucoDetector.
setDictionary
Sets and replaces the first dictionary in internal list to be used for marker detection.
setDictionary(dictionary: aruco_Dictionary): void;dictionaryThe new dictionary that will replace the first dictionary in the internal list.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.