OpenCV for Unity  2.6.0
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.9.0/index.html ) for the details of the argument of the method.
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
OpenCVForUnity.ObjdetectModule.ArucoDetector Class Reference

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

Inheritance diagram for OpenCVForUnity.ObjdetectModule.ArucoDetector:
OpenCVForUnity.CoreModule.Algorithm OpenCVForUnity.DisposableOpenCVObject OpenCVForUnity.DisposableObject

Public Member Functions

 ArucoDetector (Dictionary dictionary, DetectorParameters detectorParams, RefineParameters refineParams)
 Basic ArucoDetector constructor. More...
 
 ArucoDetector (Dictionary dictionary, DetectorParameters detectorParams)
 Basic ArucoDetector constructor. More...
 
 ArucoDetector (Dictionary dictionary)
 Basic ArucoDetector constructor. More...
 
 ArucoDetector ()
 Basic ArucoDetector constructor. More...
 
void detectMarkers (Mat image, List< Mat > corners, Mat ids, List< Mat > rejectedImgPoints)
 Basic marker detection. More...
 
void detectMarkers (Mat image, List< Mat > corners, Mat ids)
 Basic marker detection. More...
 
void refineDetectedMarkers (Mat image, Board board, List< Mat > detectedCorners, Mat detectedIds, List< Mat > rejectedCorners, Mat cameraMatrix, Mat distCoeffs, Mat recoveredIdxs)
 Refine not detected markers based on the already detected and the board layout. More...
 
void refineDetectedMarkers (Mat image, Board board, List< Mat > detectedCorners, Mat detectedIds, List< Mat > rejectedCorners, Mat cameraMatrix, Mat distCoeffs)
 Refine not detected markers based on the already detected and the board layout. More...
 
void refineDetectedMarkers (Mat image, Board board, List< Mat > detectedCorners, Mat detectedIds, List< Mat > rejectedCorners, Mat cameraMatrix)
 Refine not detected markers based on the already detected and the board layout. More...
 
void refineDetectedMarkers (Mat image, Board board, List< Mat > detectedCorners, Mat detectedIds, List< Mat > rejectedCorners)
 Refine not detected markers based on the already detected and the board layout. More...
 
Dictionary getDictionary ()
 
void setDictionary (Dictionary dictionary)
 
DetectorParameters getDetectorParameters ()
 
void setDetectorParameters (DetectorParameters detectorParameters)
 
RefineParameters getRefineParameters ()
 
void setRefineParameters (RefineParameters refineParameters)
 
- Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
IntPtr getNativeObjAddr ()
 
virtual void clear ()
 Clears the algorithm state. More...
 
virtual bool empty ()
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More...
 
void save (string filename)
 
virtual string getDefaultName ()
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static new ArucoDetector __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
static Algorithm __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

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() [1/4]

OpenCVForUnity.ObjdetectModule.ArucoDetector.ArucoDetector ( Dictionary  dictionary,
DetectorParameters  detectorParams,
RefineParameters  refineParams 
)

Basic ArucoDetector constructor.

Parameters
dictionaryindicates the type of markers that will be searched
detectorParamsmarker detection parameters
refineParamsmarker refine detection parameters

◆ ArucoDetector() [2/4]

OpenCVForUnity.ObjdetectModule.ArucoDetector.ArucoDetector ( Dictionary  dictionary,
DetectorParameters  detectorParams 
)

Basic ArucoDetector constructor.

Parameters
dictionaryindicates the type of markers that will be searched
detectorParamsmarker detection parameters
refineParamsmarker refine detection parameters

◆ ArucoDetector() [3/4]

OpenCVForUnity.ObjdetectModule.ArucoDetector.ArucoDetector ( Dictionary  dictionary)

Basic ArucoDetector constructor.

Parameters
dictionaryindicates the type of markers that will be searched
detectorParamsmarker detection parameters
refineParamsmarker refine detection parameters

◆ ArucoDetector() [4/4]

OpenCVForUnity.ObjdetectModule.ArucoDetector.ArucoDetector ( )

Basic ArucoDetector constructor.

Parameters
dictionaryindicates the type of markers that will be searched
detectorParamsmarker detection parameters
refineParamsmarker refine detection parameters

Member Function Documentation

◆ __fromPtr__()

static new ArucoDetector OpenCVForUnity.ObjdetectModule.ArucoDetector.__fromPtr__ ( IntPtr  addr)
static

◆ detectMarkers() [1/2]

void OpenCVForUnity.ObjdetectModule.ArucoDetector.detectMarkers ( Mat  image,
List< Mat corners,
Mat  ids,
List< Mat rejectedImgPoints 
)

Basic marker detection.

Parameters
imageinput image
cornersvector 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.
idsvector 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.
rejectedImgPointscontains 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 specific 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

◆ detectMarkers() [2/2]

void OpenCVForUnity.ObjdetectModule.ArucoDetector.detectMarkers ( Mat  image,
List< Mat corners,
Mat  ids 
)

Basic marker detection.

Parameters
imageinput image
cornersvector 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.
idsvector 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.
rejectedImgPointscontains 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 specific 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

◆ Dispose()

override void OpenCVForUnity.ObjdetectModule.ArucoDetector.Dispose ( bool  disposing)
protectedvirtual

◆ getDetectorParameters()

DetectorParameters OpenCVForUnity.ObjdetectModule.ArucoDetector.getDetectorParameters ( )

◆ getDictionary()

Dictionary OpenCVForUnity.ObjdetectModule.ArucoDetector.getDictionary ( )

◆ getRefineParameters()

RefineParameters OpenCVForUnity.ObjdetectModule.ArucoDetector.getRefineParameters ( )

◆ refineDetectedMarkers() [1/4]

void OpenCVForUnity.ObjdetectModule.ArucoDetector.refineDetectedMarkers ( Mat  image,
Board  board,
List< Mat detectedCorners,
Mat  detectedIds,
List< Mat rejectedCorners,
Mat  cameraMatrix,
Mat  distCoeffs,
Mat  recoveredIdxs 
)

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

Parameters
imageinput image
boardlayout of markers in the board.
detectedCornersvector of already detected marker corners.
detectedIdsvector of already detected marker identifiers.
rejectedCornersvector 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 elements
recoveredIdxsOptional 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.

◆ refineDetectedMarkers() [2/4]

void OpenCVForUnity.ObjdetectModule.ArucoDetector.refineDetectedMarkers ( Mat  image,
Board  board,
List< Mat detectedCorners,
Mat  detectedIds,
List< Mat rejectedCorners,
Mat  cameraMatrix,
Mat  distCoeffs 
)

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

Parameters
imageinput image
boardlayout of markers in the board.
detectedCornersvector of already detected marker corners.
detectedIdsvector of already detected marker identifiers.
rejectedCornersvector 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 elements
recoveredIdxsOptional 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.

◆ refineDetectedMarkers() [3/4]

void OpenCVForUnity.ObjdetectModule.ArucoDetector.refineDetectedMarkers ( Mat  image,
Board  board,
List< Mat detectedCorners,
Mat  detectedIds,
List< Mat rejectedCorners,
Mat  cameraMatrix 
)

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

Parameters
imageinput image
boardlayout of markers in the board.
detectedCornersvector of already detected marker corners.
detectedIdsvector of already detected marker identifiers.
rejectedCornersvector 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 elements
recoveredIdxsOptional 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.

◆ refineDetectedMarkers() [4/4]

void OpenCVForUnity.ObjdetectModule.ArucoDetector.refineDetectedMarkers ( Mat  image,
Board  board,
List< Mat detectedCorners,
Mat  detectedIds,
List< Mat rejectedCorners 
)

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

Parameters
imageinput image
boardlayout of markers in the board.
detectedCornersvector of already detected marker corners.
detectedIdsvector of already detected marker identifiers.
rejectedCornersvector 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 elements
recoveredIdxsOptional 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.

◆ setDetectorParameters()

void OpenCVForUnity.ObjdetectModule.ArucoDetector.setDetectorParameters ( DetectorParameters  detectorParameters)

◆ setDictionary()

void OpenCVForUnity.ObjdetectModule.ArucoDetector.setDictionary ( Dictionary  dictionary)

◆ setRefineParameters()

void OpenCVForUnity.ObjdetectModule.ArucoDetector.setRefineParameters ( RefineParameters  refineParameters)

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