Class CvAruco
aruco module
Inheritance
Inherited Members
Namespace: OpenCvSharp.Aruco
Assembly: OpenCvSharp.dll
Syntax
public static class CvAruco
Methods
| Improve this Doc View SourceDetectCharucoDiamond(InputArray, Point2f[][], IEnumerable<Int32>, Single, out Point2f[][], out Vec4i[], InputArray, InputArray)
Detect ChArUco Diamond markers.
Declaration
public static void DetectCharucoDiamond(InputArray image, Point2f[][] markerCorners, IEnumerable<int> markerIds, float squareMarkerLengthRate, out Point2f[][] diamondCorners, out Vec4i[] diamondIds, InputArray cameraMatrix = null, InputArray distCoeffs = null)
Parameters
Type | Name | Description |
---|---|---|
InputArray | image | input image necessary for corner subpixel. |
OpenCvSharp.Point2f[][] | markerCorners | list of detected marker corners from detectMarkers function. |
IEnumerable<System.Int32> | markerIds | list of marker ids in markerCorners. |
System.Single | squareMarkerLengthRate | rate between square and marker length: squareMarkerLengthRate = squareLength/markerLength. The real units are not necessary. |
OpenCvSharp.Point2f[][] | diamondCorners | output list of detected diamond corners (4 corners per diamond). The order is the same than in marker corners: top left, top right, bottom right and bottom left. Similar format than the corners returned by detectMarkers (e.g std::vector<std::vector<cv::Point2f>>). |
Vec4i[] | diamondIds | ids of the diamonds in diamondCorners. The id of each diamond is in fact of type Vec4i, so each diamond has 4 ids, which are the ids of the aruco markers composing the diamond. |
InputArray | cameraMatrix | Optional camera calibration matrix. |
InputArray | distCoeffs | Optional camera distortion coefficients. |
DetectMarkers(InputArray, Dictionary, out Point2f[][], out Int32[], DetectorParameters, out Point2f[][])
Basic marker detection
Declaration
public static void DetectMarkers(InputArray image, Dictionary dictionary, out Point2f[][] corners, out int[] ids, DetectorParameters parameters, out Point2f[][] rejectedImgPoints)
Parameters
Type | Name | Description |
---|---|---|
InputArray | image | input image |
Dictionary | dictionary | indicates the type of markers that will be searched |
OpenCvSharp.Point2f[][] | corners | vector of detected marker corners. For each marker, its four corners are provided. For N detected markers, the dimensions of this array is Nx4.The order of the corners is clockwise. |
System.Int32[] | ids | vector of identifiers of the detected markers. The identifier is of type 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. |
DetectorParameters | parameters | marker detection parameters |
OpenCvSharp.Point2f[][] | rejectedImgPoints | contains the imgPoints of those squares whose inner code has not a correct codification.Useful for debugging purposes. |
DrawDetectedDiamonds(InputArray, Point2f[][], Nullable<IEnumerable<Vec4i>>)
Draw a set of detected ChArUco Diamond markers.
Declaration
public static void DrawDetectedDiamonds(InputArray image, Point2f[][] diamondCorners, IEnumerable<Vec4i>? diamondIds = null)
Parameters
Type | Name | Description |
---|---|---|
InputArray | image | input/output image. It must have 1 or 3 channels. The number of channels is not altered. |
OpenCvSharp.Point2f[][] | diamondCorners | positions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vector<std::vector<cv::Point2f>>). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise. |
System.Nullable<IEnumerable<Vec4i>> | diamondIds | vector of identifiers for diamonds in diamondCorners, in the same format returned by detectCharucoDiamond() (e.g. std::vector<Vec4i>). Optional, if not provided, ids are not painted. |
DrawDetectedDiamonds(InputArray, Point2f[][], Nullable<IEnumerable<Vec4i>>, Scalar)
Draw a set of detected ChArUco Diamond markers.
Declaration
public static void DrawDetectedDiamonds(InputArray image, Point2f[][] diamondCorners, IEnumerable<Vec4i>? diamondIds, Scalar borderColor)
Parameters
Type | Name | Description |
---|---|---|
InputArray | image | input/output image. It must have 1 or 3 channels. The number of channels is not altered. |
OpenCvSharp.Point2f[][] | diamondCorners | positions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vector<std::vector<cv::Point2f>>). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise. |
System.Nullable<IEnumerable<Vec4i>> | diamondIds | vector of identifiers for diamonds in diamondCorners, in the same format returned by detectCharucoDiamond() (e.g. std::vector<Vec4i>). Optional, if not provided, ids are not painted. |
OpenCvSharp.Scalar | borderColor | color of marker borders. Rest of colors (text color and first corner color) are calculated based on this one. |
DrawDetectedMarkers(InputArray, Point2f[][], IEnumerable<Int32>)
Draw detected markers in image
Declaration
public static void DrawDetectedMarkers(InputArray image, Point2f[][] corners, IEnumerable<int> ids)
Parameters
Type | Name | Description |
---|---|---|
InputArray | image | input/output image. It must have 1 or 3 channels. The number of channels is not altered. |
OpenCvSharp.Point2f[][] | corners | positions of marker corners on input image. For N detected markers, the dimensions of this array should be Nx4.The order of the corners should be clockwise. |
IEnumerable<System.Int32> | ids | vector of identifiers for markers in markersCorners. Optional, if not provided, ids are not painted. |
DrawDetectedMarkers(InputArray, Point2f[][], Nullable<IEnumerable<Int32>>, Scalar)
Draw detected markers in image
Declaration
public static void DrawDetectedMarkers(InputArray image, Point2f[][] corners, IEnumerable<int>? ids, Scalar borderColor)
Parameters
Type | Name | Description |
---|---|---|
InputArray | image | input/output image. It must have 1 or 3 channels. The number of channels is not altered. |
OpenCvSharp.Point2f[][] | corners | positions of marker corners on input image. For N detected markers, the dimensions of this array should be Nx4.The order of the corners should be clockwise. |
System.Nullable<IEnumerable<System.Int32>> | ids | vector of identifiers for markers in markersCorners. Optional, if not provided, ids are not painted. |
OpenCvSharp.Scalar | borderColor | color of marker borders. Rest of colors (text color and first corner color) are calculated based on this one to improve visualization. |
EstimatePoseSingleMarkers(Point2f[][], Single, InputArray, InputArray, OutputArray, OutputArray, OutputArray)
Pose estimation for single markers
Declaration
public static void EstimatePoseSingleMarkers(Point2f[][] corners, float markerLength, InputArray cameraMatrix, InputArray distortionCoefficients, OutputArray rvec, OutputArray tvec, OutputArray objPoints = null)
Parameters
Type | Name | Description |
---|---|---|
OpenCvSharp.Point2f[][] | corners | corners vector of already detected markers 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 should be Nx4. The order of the corners should be clockwise. |
System.Single | markerLength | the length of the markers' side. The returning translation vectors will be in the same unit.Normally, unit is meters. |
InputArray | cameraMatrix | input 3x3 floating-point camera matrix \f$A = \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}\f$ |
InputArray | distortionCoefficients | vector of distortion coefficients \f$(k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6],[s_1, s_2, s_3, s_4]])\f$ of 4, 5, 8 or 12 elements |
OutputArray | rvec | array of output rotation vectors (@sa Rodrigues) (e.g. std::vector<cv::Vec3d>). Each element in rvecs corresponds to the specific marker in imgPoints. |
OutputArray | tvec | array of output translation vectors (e.g. std::vector<cv::Vec3d>). Each element in tvecs corresponds to the specific marker in imgPoints. |
OutputArray | objPoints | array of object points of all the marker corners |
GetPredefinedDictionary(PredefinedDictionaryName)
Returns one of the predefined dictionaries defined in PREDEFINED_DICTIONARY_NAME
Declaration
public static Dictionary GetPredefinedDictionary(PredefinedDictionaryName name)
Parameters
Type | Name | Description |
---|---|---|
PredefinedDictionaryName | name |
Returns
Type | Description |
---|---|
Dictionary |
ReadDictionary(String)
Reads a new dictionary from FileNode.
Declaration
public static Dictionary ReadDictionary(string dictionaryFile)
Parameters
Type | Name | Description |
---|---|---|
System.String | dictionaryFile | The path of the dictionary file |
Returns
Type | Description |
---|---|
Dictionary | Instance of a Dictionary |
Remarks
Dictionary format is YAML see sample below
nmarkers: 35
markersize: 6
maxCorrectionBits: 5
marker_0: "101011111011111001001001101100000000"
...
marker_34: "011111010000111011111110110101100101"