Package org.opencv.objdetect

## Class CharucoBoard

- java.lang.Object
- - org.opencv.objdetect.Board
  - - org.opencv.objdetect.CharucoBoard

-     public class CharucoBoard
      extends Board

  ChArUco board is a planar chessboard where the markers are placed inside the white squares of a chessboard. The benefits of ChArUco boards is that they provide both, ArUco markers versatility and chessboard corner precision, which is important for calibration and pose estimation. The board image can be drawn using generateImage() method.

- - ### Field Summary

    - ### Fields inherited from class org.opencv.objdetect.Board

      `nativeObj`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `CharucoBoard​(long addr)` |
    `` | `CharucoBoard​(Size size, float squareLength, float markerLength, Dictionary dictionary)` | CharucoBoard constructor
    `` | `CharucoBoard​(Size size, float squareLength, float markerLength, Dictionary dictionary, Mat ids)` | CharucoBoard constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static CharucoBoard` | `__fromPtr__​(long addr)` |
    `boolean` | `checkCharucoCornersCollinear​(Mat charucoIds)` | check whether the ChArUco markers are collinear
    `protected void` | `finalize()` |
    `MatOfPoint3f` | `getChessboardCorners()` | get CharucoBoard::chessboardCorners
    `Size` | `getChessboardSize()` |
    `boolean` | `getLegacyPattern()` |
    `float` | `getMarkerLength()` |
    `float` | `getSquareLength()` |
    `void` | `setLegacyPattern​(boolean legacyPattern)` | set legacy chessboard pattern.

    - ### Methods inherited from class org.opencv.objdetect.Board

      `generateImage, generateImage, generateImage, getDictionary, getIds, getNativeObjAddr, getObjPoints, getRightBottomCorner, matchImagePoints`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CharucoBoard

          protected CharucoBoard​(long addr)

    - #### CharucoBoard

          public CharucoBoard​(Size size,
                              float squareLength,
                              float markerLength,
                              Dictionary dictionary,
                              Mat ids)

      CharucoBoard constructor
      Parameters:
        `size` - number of chessboard squares in x and y directions
        `squareLength` - squareLength chessboard square side length (normally in meters)
        `markerLength` - marker side length (same unit than squareLength)
        `dictionary` - dictionary of markers indicating the type of markers
        `ids` - array of id used markers The first markers in the dictionary are used to fill the white chessboard squares.

    - #### CharucoBoard

          public CharucoBoard​(Size size,
                              float squareLength,
                              float markerLength,
                              Dictionary dictionary)

      CharucoBoard constructor
      Parameters:
        `size` - number of chessboard squares in x and y directions
        `squareLength` - squareLength chessboard square side length (normally in meters)
        `markerLength` - marker side length (same unit than squareLength)
        `dictionary` - dictionary of markers indicating the type of markers The first markers in the dictionary are used to fill the white chessboard squares.

  - ### Method Detail

    - #### __fromPtr__

          public static CharucoBoard __fromPtr__​(long addr)

    - #### setLegacyPattern

          public void setLegacyPattern​(boolean legacyPattern)

      set legacy chessboard pattern. Legacy setting creates chessboard patterns starting with a white box in the upper left corner if there is an even row count of chessboard boxes, otherwise it starts with a black box. This setting ensures compatibility to patterns created with OpenCV versions prior OpenCV 4.6.0. See https://github.com/opencv/opencv/issues/23152. Default value: false.
      Parameters:
        `legacyPattern` - automatically generated

    - #### getLegacyPattern

          public boolean getLegacyPattern()

    - #### getChessboardSize

          public Size getChessboardSize()

    - #### getSquareLength

          public float getSquareLength()

    - #### getMarkerLength

          public float getMarkerLength()

    - #### getChessboardCorners

          public MatOfPoint3f getChessboardCorners()

      get CharucoBoard::chessboardCorners
      Returns:
        automatically generated

    - #### checkCharucoCornersCollinear

          public boolean checkCharucoCornersCollinear​(Mat charucoIds)

      check whether the ChArUco markers are collinear
      Parameters:
        `charucoIds` - list of identifiers for each corner in charucoCorners per frame.
      Returns:
        bool value, 1 (true) if detected corners form a line, 0 (false) if they do not. solvePnP, calibration functions will fail if the corners are collinear (true). The number of ids in charucoIDs should be <= the number of chessboard corners in the board. This functions checks whether the charuco corners are on a straight line (returns true, if so), or not (false). Axis parallel, as well as diagonal and other straight lines detected. Degenerate cases: for number of charucoIDs <= 2,the function returns true.

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `Board`
      Throws:
        `java.lang.Throwable`