Class ArucoDetector
- Namespace
- OpenCvSharp.Aruco
- Assembly
- OpenCvSharp.dll
The main functionality of ArucoDetector class is detection of markers in an image with detectMarkers() method.
public class ArucoDetector : CvObject, IDisposable
- Inheritance
-
ArucoDetector
- Implements
- Inherited Members
Constructors
ArucoDetector(Dictionary)
Creates ArucoDetector with default parameters.
public ArucoDetector(Dictionary dictionary)
Parameters
dictionaryDictionary
ArucoDetector(Dictionary, DetectorParameters, RefineParameters)
Creates ArucoDetector.
public ArucoDetector(Dictionary dictionary, DetectorParameters detectorParams, RefineParameters refineParams)
Parameters
dictionaryDictionarydetectorParamsDetectorParametersrefineParamsRefineParameters
ArucoDetector(IEnumerable<Dictionary>, DetectorParameters, RefineParameters)
Creates ArucoDetector for multiple dictionaries.
public ArucoDetector(IEnumerable<Dictionary> dictionaries, DetectorParameters detectorParams, RefineParameters refineParams)
Parameters
dictionariesIEnumerable<Dictionary>indicates the types of markers that will be searched. Empty dictionaries will throw an error.
detectorParamsDetectorParametersmarker detection parameters
refineParamsRefineParametersmarker refine detection parameters
Methods
DetectMarkers(InputArray, out Point2f[][], out int[], out Point2f[][])
Basic marker detection.
public void DetectMarkers(InputArray image, out Point2f[][] corners, out int[] ids, out Point2f[][] rejectedImgPoints)
Parameters
imageInputArraycornersPoint2f[][]idsint[]rejectedImgPointsPoint2f[][]
DetectMarkersMultiDict(InputArray, out Point2f[][], out int[], out Point2f[][], out int[])
Basic marker detection using all configured dictionaries.
public void DetectMarkersMultiDict(InputArray image, out Point2f[][] corners, out int[] ids, out Point2f[][] rejectedImgPoints, out int[] dictIndices)
Parameters
imageInputArrayinput image
cornersPoint2f[][]vector of detected marker corners. For each marker, its four corners are provided.
idsint[]vector of identifiers of the detected markers.
rejectedImgPointsPoint2f[][]contains the imgPoints of those squares whose inner code has not a correct codification.
dictIndicesint[]vector of dictionary indices for each detected marker. Use GetDictionaries() to get the list of corresponding dictionaries.
DetectMarkersWithConfidence(InputArray, out Point2f[][], out int[], out float[], out Point2f[][])
Marker detection with confidence computation.
public void DetectMarkersWithConfidence(InputArray image, out Point2f[][] corners, out int[] ids, out float[] markersConfidence, out Point2f[][] rejectedImgPoints)
Parameters
imageInputArrayinput image
cornersPoint2f[][]vector of detected marker corners. For each marker, its four corners are provided.
idsint[]vector of identifiers of the detected markers.
markersConfidencefloat[]contains the normalized confidence [0;1] of the markers' detection.
rejectedImgPointsPoint2f[][]contains the imgPoints of those squares whose inner code has not a correct codification.
GetDetectorParameters()
Gets the detector parameters currently used for marker detection.
public DetectorParameters GetDetectorParameters()
Returns
GetDictionaries()
Returns all dictionaries currently used for marker detection.
public Dictionary[] GetDictionaries()
Returns
GetDictionary()
Returns first dictionary from internal list used for marker detection.
public Dictionary GetDictionary()
Returns
GetRefineParameters()
Gets the marker refine detection parameters currently used.
public RefineParameters GetRefineParameters()
Returns
Read(FileNode)
Reads algorithm parameters from a file storage.
public void Read(FileNode fn)
Parameters
fnFileNode
RefineDetectedMarkers(InputArray, Board, Point2f[][], int[], Point2f[][], out Point2f[][], out int[], out Point2f[][], out int[], InputArray, InputArray)
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 DetectMarkers function.
public void RefineDetectedMarkers(InputArray image, Board board, Point2f[][] detectedCorners, int[] detectedIds, Point2f[][] rejectedCorners, out Point2f[][] newDetectedCorners, out int[] newDetectedIds, out Point2f[][] newRejectedCorners, out int[] recoveredIdxs, InputArray cameraMatrix = default, InputArray distCoeffs = default)
Parameters
imageInputArrayinput image
boardBoardlayout of markers in the board.
detectedCornersPoint2f[][]vector of already detected marker corners.
detectedIdsint[]vector of already detected marker identifiers.
rejectedCornersPoint2f[][]vector of rejected candidates during the marker detection process.
newDetectedCornersPoint2f[][]updated vector of detected marker corners, including any recovered markers.
newDetectedIdsint[]updated vector of detected marker identifiers, including any recovered markers.
newRejectedCornersPoint2f[][]updated vector of rejected candidates, with recovered markers removed.
recoveredIdxsint[]the indexes of the recovered candidates in the original rejectedCorners array.
cameraMatrixInputArrayoptional input 3x3 floating-point camera matrix
distCoeffsInputArrayoptional vector of distortion coefficients
SetDetectorParameters(DetectorParameters)
Sets the detector parameters to be used for marker detection.
public void SetDetectorParameters(DetectorParameters detectorParameters)
Parameters
detectorParametersDetectorParameters
SetDictionaries(IEnumerable<Dictionary>)
Sets the entire collection of dictionaries to be used for marker detection, replacing any existing dictionaries. Setting an empty collection of dictionaries will throw an error.
public void SetDictionaries(IEnumerable<Dictionary> dictionaries)
Parameters
dictionariesIEnumerable<Dictionary>
SetDictionary(Dictionary)
Sets and replaces the first dictionary in internal list to be used for marker detection.
public void SetDictionary(Dictionary dictionary)
Parameters
dictionaryDictionary
SetRefineParameters(RefineParameters)
Sets the marker refine detection parameters to be used.
public void SetRefineParameters(RefineParameters refineParameters)
Parameters
refineParametersRefineParameters
Write(FileStorage)
Stores algorithm parameters in a file storage.
public void Write(FileStorage fs)
Parameters
fsFileStorage