Class CharucoBoard
- Namespace
- OpenCvSharp.Aruco
- Assembly
- OpenCvSharp.dll
ChArUco board — a planar chessboard where the markers are placed inside the white squares.
public class CharucoBoard : Board, IDisposable
- Inheritance
-
CharucoBoard
- Implements
- Inherited Members
Constructors
CharucoBoard(int, int, float, float, Dictionary, IEnumerable<int>?)
Creates a CharucoBoard.
public CharucoBoard(int squaresX, int squaresY, float squareLength, float markerLength, Dictionary dictionary, IEnumerable<int>? ids = null)
Parameters
squaresXintnumber of chessboard squares in x direction
squaresYintnumber of chessboard squares in y direction
squareLengthfloatchessboard square side length (normally in meters)
markerLengthfloatmarker side length (same unit as squareLength)
dictionaryDictionarydictionary of markers
idsIEnumerable<int>array of id used markers. The first markers in the dictionary are used to fill the white chessboard squares if null.
Properties
ChessboardSize
Gets the number of chessboard squares in x and y directions.
public Size ChessboardSize { get; }
Property Value
LegacyPattern
Gets or sets the legacy pattern mode for compatibility with patterns created before OpenCV 4.6.
public bool LegacyPattern { get; set; }
Property Value
MarkerLength
Gets the marker side length.
public float MarkerLength { get; }
Property Value
SquareLength
Gets the chessboard square side length.
public float SquareLength { get; }
Property Value
Methods
CheckCharucoCornersCollinear(InputArray)
Check whether the ChArUco markers are collinear.
public bool CheckCharucoCornersCollinear(InputArray charucoIds)
Parameters
charucoIdsInputArray
Returns
GenerateImage(Size, OutputArray, int, int)
Generate the board image.
public void GenerateImage(Size outSize, OutputArray img, int marginSize = 0, int borderBits = 1)
Parameters
outSizeSizeimgOutputArraymarginSizeintborderBitsint
Remarks
Hides GenerateImage(Size, OutputArray, int, int) to call the CharucoBoard-specific native override directly (cv::aruco::CharucoBoardImpl overrides generateImage, so the inherited Board method would in fact dispatch to the same implementation via its virtual PIMPL — this override is kept for clarity/directness).
GetChessboardCorners()
Get CharucoBoard::chessboardCorners
public Point3f[] GetChessboardCorners()
Returns
- Point3f[]
GetNearestMarkerCorners()
Get CharucoBoard::nearestMarkerCorners, for each charuco corner, nearest marker corner id of each marker
public int[][] GetNearestMarkerCorners()
Returns
- int[][]
GetNearestMarkerIdx()
Get CharucoBoard::nearestMarkerIdx, for each charuco corner, nearest marker index in ids array
public int[][] GetNearestMarkerIdx()
Returns
- int[][]
MatchImagePoints(Point2f[], InputArray, OutputArray, OutputArray)
Given a board configuration and a set of detected ChArUco corners, returns the corresponding image points and object points, can be used in solvePnP(). Overload of MatchImagePoints(Point2f[][], InputArray, OutputArray, OutputArray) for CharucoBoard, whose detected corners are a flat list of ChArUco corners rather than a jagged per-marker array.
public void MatchImagePoints(Point2f[] detectedCorners, InputArray detectedIds, OutputArray objPoints, OutputArray imgPoints)
Parameters
detectedCornersPoint2f[]List of detected ChArUco corners of the board.
detectedIdsInputArrayList of identifiers for each charuco corner.
objPointsOutputArrayVector of marker points in the board coordinate space.
imgPointsOutputArrayVector of marker points in the image coordinate space.