| OpenCV 5.0.0alpha Open Source Computer Vision

Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
cv::aruco::CharucoDetector Class Reference
Object Detection » ArUco markers and boards detection for robust camera pose estimation

`#include <opencv2/objdetect/charuco_detector.hpp>`

Collaboration diagram for cv::aruco::CharucoDetector:

## Public Member Functions
| CharucoDetector (const CharucoBoard &board, const CharucoParameters &charucoParams=CharucoParameters(), const DetectorParameters &detectorParams=DetectorParameters(), const RefineParameters &refineParams=RefineParameters())
| Basic CharucoDetector constructor.
void | detectBoard (InputArray image, OutputArray charucoCorners, OutputArray charucoIds, InputOutputArrayOfArrays markerCorners=noArray(), InputOutputArray markerIds=noArray()) const
| detect aruco markers and interpolate position of ChArUco board corners
void | detectDiamonds (InputArray image, OutputArrayOfArrays diamondCorners, OutputArray diamondIds, InputOutputArrayOfArrays markerCorners=noArray(), InputOutputArray markerIds=noArray()) const
| Detect ChArUco Diamond markers.
const CharucoBoard & | getBoard () const
const CharucoParameters & | getCharucoParameters () const
const DetectorParameters & | getDetectorParameters () const
const RefineParameters & | getRefineParameters () const
void | setBoard (const CharucoBoard &board)
void | setCharucoParameters (CharucoParameters &charucoParameters)
void | setDetectorParameters (const DetectorParameters &detectorParameters)
void | setRefineParameters (const RefineParameters &refineParameters)
Public Member Functions inherited from cv::Algorithm
| Algorithm ()
virtual | ~Algorithm ()
virtual void | clear ()
| Clears the algorithm state.
virtual bool | empty () const
| Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
virtual String | getDefaultName () const
virtual void | read (const FileNode &fn)
| Reads algorithm parameters from a file storage.
virtual void | save (const String &filename) const
virtual void | write (FileStorage &fs) const
| Stores algorithm parameters in a file storage.
void | write (FileStorage &fs, const String &name) const

## Protected Attributes
Ptr< CharucoDetectorImpl > | charucoDetectorImpl

## Additional Inherited Members
Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tp > | load (const String &filename, const String &objname=String())
| Loads algorithm from the file.
template<typename _Tp >
static Ptr< _Tp > | loadFromString (const String &strModel, const String &objname=String())
| Loads algorithm from a String.
template<typename _Tp >
static Ptr< _Tp > | read (const FileNode &fn)
| Reads algorithm from the file node.
Protected Member Functions inherited from cv::Algorithm
void | writeFormat (FileStorage &fs) const

## Constructor & Destructor Documentation

## ◆ CharucoDetector()

cv::aruco::CharucoDetector::CharucoDetector | ( | const CharucoBoard & | board,
|  | const CharucoParameters & | charucoParams = CharucoParameters(),
|  | const DetectorParameters & | detectorParams = DetectorParameters(),
|  | const RefineParameters & | refineParams = RefineParameters() )

Python:
| cv.aruco.CharucoDetector( | board[, charucoParams[, detectorParams[, refineParams]]] | ) -> | <aruco_CharucoDetector object>

Basic CharucoDetector constructor.

Parameters

  board | ChAruco board
  charucoParams | charuco detection parameters
  detectorParams | marker detection parameters
  refineParams | marker refine detection parameters

## Member Function Documentation

## ◆ detectBoard()

void cv::aruco::CharucoDetector::detectBoard | ( | InputArray | image,
|  | OutputArray | charucoCorners,
|  | OutputArray | charucoIds,
|  | InputOutputArrayOfArrays | markerCorners = noArray(),
|  | InputOutputArray | markerIds = noArray() ) const

Python:
| cv.aruco.CharucoDetector.detectBoard( | image[, charucoCorners[, charucoIds[, markerCorners[, markerIds]]]] | ) -> | charucoCorners, charucoIds, markerCorners, markerIds

detect aruco markers and interpolate position of ChArUco board corners

Parameters

  image | input image necesary for corner refinement. Note that markers are not detected and should be sent in corners and ids parameters.
  charucoCorners | interpolated chessboard corners.
  charucoIds | interpolated chessboard corners identifiers.
  markerCorners | 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. If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
  markerIds | list of identifiers for each marker in corners. If markerCorners and markerCorners are empty, the function detect aruco markers and ids.

This function receives the detected markers and returns the 2D position of the chessboard corners from a ChArUco board using the detected Aruco markers.

If markerCorners and markerCorners are empty, the detectMarkers() will run and detect aruco markers and ids.

If camera parameters are provided, the process is based in an approximated pose estimation, else it is based on local homography. Only visible corners are returned. For each corner, its corresponding identifier is also returned in charucoIds.

See also
  findChessboardCorners

Note
  After OpenCV 4.6.0, there was an incompatible change in the ChArUco pattern generation algorithm for even row counts. Use cv::aruco::CharucoBoard::setLegacyPattern() to ensure compatibility with patterns created using OpenCV versions prior to 4.6.0. For more information, see the issue: https://github.com/opencv/opencv/issues/23152

Here is the call graph for this function:

## ◆ detectDiamonds()

void cv::aruco::CharucoDetector::detectDiamonds | ( | InputArray | image,
|  | OutputArrayOfArrays | diamondCorners,
|  | OutputArray | diamondIds,
|  | InputOutputArrayOfArrays | markerCorners = noArray(),
|  | InputOutputArray | markerIds = noArray() ) const

Python:
| cv.aruco.CharucoDetector.detectDiamonds( | image[, diamondCorners[, diamondIds[, markerCorners[, markerIds]]]] | ) -> | diamondCorners, diamondIds, markerCorners, markerIds

Detect ChArUco Diamond markers.

Parameters

  image | input image necessary for corner subpixel.
  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> > ).
  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.
  markerCorners | list of detected marker corners from detectMarkers function. If markerCorners and markerCorners are empty, the function detect aruco markers and ids.
  markerIds | list of marker ids in markerCorners. If markerCorners and markerCorners are empty, the function detect aruco markers and ids.

This function detects Diamond markers from the previous detected ArUco markers. The diamonds are returned in the diamondCorners and diamondIds parameters. If camera calibration parameters are provided, the diamond search is based on reprojection. If not, diamond search is based on homography. Homography is faster than reprojection, but less accurate.

Here is the call graph for this function:

## ◆ getBoard()

const CharucoBoard & cv::aruco::CharucoDetector::getBoard | ( |  | ) | const

Python:
| cv.aruco.CharucoDetector.getBoard( |  | ) -> | retval

## ◆ getCharucoParameters()

const CharucoParameters & cv::aruco::CharucoDetector::getCharucoParameters | ( |  | ) | const

Python:
| cv.aruco.CharucoDetector.getCharucoParameters( |  | ) -> | retval

## ◆ getDetectorParameters()

const DetectorParameters & cv::aruco::CharucoDetector::getDetectorParameters | ( |  | ) | const

Python:
| cv.aruco.CharucoDetector.getDetectorParameters( |  | ) -> | retval

## ◆ getRefineParameters()

const RefineParameters & cv::aruco::CharucoDetector::getRefineParameters | ( |  | ) | const

Python:
| cv.aruco.CharucoDetector.getRefineParameters( |  | ) -> | retval

## ◆ setBoard()

void cv::aruco::CharucoDetector::setBoard | ( | const CharucoBoard & | board | ) |

Python:
| cv.aruco.CharucoDetector.setBoard( | board | ) -> | None

## ◆ setCharucoParameters()

void cv::aruco::CharucoDetector::setCharucoParameters | ( | CharucoParameters & | charucoParameters | ) |

Python:
| cv.aruco.CharucoDetector.setCharucoParameters( | charucoParameters | ) -> | None

## ◆ setDetectorParameters()

void cv::aruco::CharucoDetector::setDetectorParameters | ( | const DetectorParameters & | detectorParameters | ) |

Python:
| cv.aruco.CharucoDetector.setDetectorParameters( | detectorParameters | ) -> | None

## ◆ setRefineParameters()

void cv::aruco::CharucoDetector::setRefineParameters | ( | const RefineParameters & | refineParameters | ) |

Python:
| cv.aruco.CharucoDetector.setRefineParameters( | refineParameters | ) -> | None

## Member Data Documentation

## ◆ charucoDetectorImpl

Ptr<CharucoDetectorImpl> cv::aruco::CharucoDetector::charucoDetectorImpl
| protected

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

- opencv2/objdetect/charuco_detector.hpp