Expand description
§Object Detection
§Barcode detection and decoding
§QRCode detection and encoding
§DNN-based face detection and recognition
Check [tutorial_dnn_face] “the corresponding tutorial” for more details.
§Common functions and classes
§ArUco markers and boards detection for robust camera pose estimation
ArUco Marker Detection
Square fiducial markers (also known as Augmented Reality Markers) are useful for easy,
fast and robust camera pose estimation.
The main functionality of ArucoDetector class is detection of markers in an image. If the markers are grouped
as a board, then you can try to recover the missing markers with ArucoDetector::refineDetectedMarkers().
ArUco markers can also be used for advanced chessboard corner finding. To do this, group the markers in the
CharucoBoard and find the corners of the chessboard with the CharucoDetector::detectBoard().
The implementation is based on the ArUco Library by R. Muñoz-Salinas and S. Garrido-Jurado [Aruco2014](https://docs.opencv.org/5.0.0/d0/de3/citelist.html#CITEREF_Aruco2014).
Markers can also be detected based on the AprilTag 2 [wang2016iros](https://docs.opencv.org/5.0.0/d0/de3/citelist.html#CITEREF_wang2016iros) fiducial marker detection method.§See also
Aruco2014 This code has been originally developed by Sergio Garrido-Jurado as a project for Google Summer of Code 2015 (GSoC 15).
<br>
@warning In OpenCV, the order of the returned corners locations for the AprilTag family is not aligned with the ArUco one.
Note that this order is also different from the convention adopted by the official [AprilTag library](https://github.com/AprilRobotics/apriltag/).
 { width=80% }
<br>
An overview of the supported ArUco markers family is visible in the following image:
 { width=80% }
<br>
An overview of the supported AprilTag markers family is visible in the following image:
 { width=80% }Note: The generated images (in the above picture) using [aruco::generateImageMarker] for the AprilTag markers have been rotated by 180 degree in order to match the official AprilTag images. When using the [aruco::generateImageMarker] function, it will output by default a different image from the official AprilTag convention, see the AprilRobotics/apriltag-imgs repository. This is the reason why you see a different corners order between ArUco and AprilTag in the above image.
<br>
For the ArUco marker family, the recommended family is the DICT_ARUCO_MIP_36h12 one, [see](https://stackoverflow.com/a/51511558).
In general, a smaller marker family (e.g. `4x4` vs `6x6`) should give you a better detection rate with respect to the camera distance,
at the expense of having more probability to have issues with false detection or marker id decoding error.
The number of marker ids in a family is also something to take into account with respect to the application use case and the ability
to correct wrong bits during the marker id decoding process.
You can download some pregenerated MIP_36h12 ArUco marker images from:
- <https://sourceforge.net/projects/aruco/files/>
- or use the `samples/cpp/tutorial_code/objectDetection/create_marker.cpp` sample to generate the marker image for your
desired marker family (which uses the [aruco::generateImageMarker] function)
For the AprilTag family, you can find some pregenerated marker images in the
[AprilRobotics/apriltag-imgs](https://github.com/AprilRobotics/apriltag-imgs) repository.Note: For accurate corners location extraction, a white border (to have a strong gradient between white and black transition) around the marker is important. This is necessary to precisely extract the marker contour in difficult conditions such as bad illumination, confusing color background, etc.
<br>
There are multiple parameters which can be tweaked to improve the marker detection rate or to be adapted to your use case (e.g. image resolution).
Please refer to the:
- [aruco::DetectorParameters]
- "Detector Parameters" section in the [tutorial_aruco_detection] tutorial or in the [tutorial_aruco_faq] page
- [ArUco Library Documentation](https://drive.google.com/file/d/1OiavRVYVJ-WH88sQg1LUsh8CuJZUQyrX) for additional information from the ArUco library
The corner refinement method can be changed according to the [aruco::CornerRefineMethod] to improve the corners location accuracy
at the expense of more computation time.
<br>
To estimate the marker pose with respect to the camera frame, we recommend you to look at the following sources of information:
- [tutorial_aruco_detection] for a tutorial about ArUco markers detection
- [_3d] for some theoretical background about the pinhole camera model and the [calib3d_solvePnP] page
- [solvePnP], [solvePnPGeneric], [solveP3P] for the relevant pose estimation methodsModules§
Structs§
- Aruco
Detector - The main functionality of ArucoDetector class is detection of markers in an image with detectMarkers() method.
- Barcode
Detector - Board
- Board of ArUco markers
- CChecker
- CChecker
- CChecker
Detector - A class to find the positions of the ColorCharts in the image.
- Charuco
Board - ChArUco board is a planar chessboard where the markers are placed inside the white squares of a chessboard.
- Charuco
Detector - Charuco
Parameters - Circles
Grid Finder Parameters - Detector
Parameters - struct DetectorParameters is used by ArucoDetector
- Detector
ParametersMCC - struct DetectorParametersMCC is used by CCheckerDetector
- Dictionary
- Dictionary is a set of unique ArUco markers of the same size
- Face
DetectorYN - DNN-based face detector
- Face
RecognizerSF - DNN-based face recognizer
- Graphical
Code Detector - Grid
Board - Planar board with grid arrangement of markers
- QRCode
Detector - QR code detector.
- QRCode
Detector Aruco - QR code detector based on Aruco markers detection code.
- QRCode
Detector Aruco_ Params - QRCode
Encoder - QR code encoder.
- QRCode
Encoder_ Params - QR code encoder parameters.
- Refine
Parameters - struct RefineParameters is used by ArucoDetector
Enums§
- Circles
Grid Finder Parameters_ Grid Type - Color
Chart - ColorChart
- Corner
Refine Method - Face
RecognizerSF_ DisType - Definition of distance used for calculating the distance between two face features
- Predefined
Dictionary Type - Predefined markers dictionaries/sets
- QRCode
Encoder_ Correction Level - QRCode
Encoder_ ECIEncodings - QRCode
Encoder_ Encode Mode
Constants§
- CALIB_
CB_ ACCURACY - CALIB_
CB_ ADAPTIVE_ THRESH - CALIB_
CB_ ASYMMETRIC_ GRID - CALIB_
CB_ CLUSTERING - CALIB_
CB_ EXHAUSTIVE - CALIB_
CB_ FAST_ CHECK - CALIB_
CB_ FILTER_ QUADS - CALIB_
CB_ LARGER - CALIB_
CB_ MARKER - CALIB_
CB_ NORMALIZE_ IMAGE - CALIB_
CB_ PLAIN - CALIB_
CB_ SYMMETRIC_ GRID - CORNER_
REFINE_ APRILTAG - Tag and corners detection based on the AprilTag 2 approach wang2016iros
- CORNER_
REFINE_ CONTOUR - ArUco approach and refine the corners locations using the contour-points line fitting
- CORNER_
REFINE_ NONE - Tag and corners detection based on the ArUco approach
- CORNER_
REFINE_ SUBPIX - ArUco approach and refine the corners locations using corner subpixel accuracy
- Circles
Grid Finder Parameters_ ASYMMETRIC_ GRID - Circles
Grid Finder Parameters_ SYMMETRIC_ GRID - DEFAULT_
VALID_ BIT_ ID_ THRESHOLD - DICT_
4X4_ 50 - 4x4 bits, minimum hamming distance between any two codes = 4, 50 codes
- DICT_
4X4_ 100 - 4x4 bits, minimum hamming distance between any two codes = 3, 100 codes
- DICT_
4X4_ 250 - 4x4 bits, minimum hamming distance between any two codes = 3, 250 codes
- DICT_
4X4_ 1000 - 4x4 bits, minimum hamming distance between any two codes = 2, 1000 codes
- DICT_
5X5_ 50 - 5x5 bits, minimum hamming distance between any two codes = 8, 50 codes
- DICT_
5X5_ 100 - 5x5 bits, minimum hamming distance between any two codes = 7, 100 codes
- DICT_
5X5_ 250 - 5x5 bits, minimum hamming distance between any two codes = 6, 250 codes
- DICT_
5X5_ 1000 - 5x5 bits, minimum hamming distance between any two codes = 5, 1000 codes
- DICT_
6X6_ 50 - 6x6 bits, minimum hamming distance between any two codes = 13, 50 codes
- DICT_
6X6_ 100 - 6x6 bits, minimum hamming distance between any two codes = 12, 100 codes
- DICT_
6X6_ 250 - 6x6 bits, minimum hamming distance between any two codes = 11, 250 codes
- DICT_
6X6_ 1000 - 6x6 bits, minimum hamming distance between any two codes = 9, 1000 codes
- DICT_
7X7_ 50 - 7x7 bits, minimum hamming distance between any two codes = 19, 50 codes
- DICT_
7X7_ 100 - 7x7 bits, minimum hamming distance between any two codes = 18, 100 codes
- DICT_
7X7_ 250 - 7x7 bits, minimum hamming distance between any two codes = 17, 250 codes
- DICT_
7X7_ 1000 - 7x7 bits, minimum hamming distance between any two codes = 14, 1000 codes
- DICT_
APRILTAG_ 16h5 - 4x4 bits, minimum hamming distance between any two codes = 5, 30 codes
- DICT_
APRILTAG_ 25h9 - 5x5 bits, minimum hamming distance between any two codes = 9, 35 codes
- DICT_
APRILTAG_ 36h10 - 6x6 bits, minimum hamming distance between any two codes = 10, 2320 codes
- DICT_
APRILTAG_ 36h11 - 6x6 bits, minimum hamming distance between any two codes = 11, 587 codes
- DICT_
ARUCO_ MIP_ 36h12 - 6x6 bits, minimum hamming distance between any two codes = 12, 250 codes
- DICT_
ARUCO_ ORIGINAL - 6x6 bits, minimum hamming distance between any two codes = 3, 1024 codes
- Face
RecognizerSF_ FR_ COSINE - Face
RecognizerSF_ FR_ NORM_ L2 - MCC24
- Standard Macbeth Chart with 24 squares
- QRCode
Encoder_ CORRECT_ LEVEL_ H - QRCode
Encoder_ CORRECT_ LEVEL_ L - QRCode
Encoder_ CORRECT_ LEVEL_ M - QRCode
Encoder_ CORRECT_ LEVEL_ Q - QRCode
Encoder_ ECI_ SHIFT_ JIS - QRCode
Encoder_ ECI_ UTF8 - QRCode
Encoder_ MODE_ ALPHANUMERIC - QRCode
Encoder_ MODE_ AUTO - QRCode
Encoder_ MODE_ BYTE - QRCode
Encoder_ MODE_ ECI - QRCode
Encoder_ MODE_ KANJI - QRCode
Encoder_ MODE_ NUMERIC - QRCode
Encoder_ MODE_ STRUCTURED_ APPEND - SG140
- DigitalSG with 140 squares
- VINYL18
- DKK color chart with 12 squares and 6 rectangle
Traits§
- Aruco
Detector Trait - Mutable methods for crate::objdetect::ArucoDetector
- Aruco
Detector Trait Const - Constant methods for crate::objdetect::ArucoDetector
- Barcode
Detector Trait - Mutable methods for crate::objdetect::BarcodeDetector
- Barcode
Detector Trait Const - Constant methods for crate::objdetect::BarcodeDetector
- Board
Trait - Mutable methods for crate::objdetect::Board
- Board
Trait Const - Constant methods for crate::objdetect::Board
- CChecker
Detector Trait - Mutable methods for crate::objdetect::CCheckerDetector
- CChecker
Detector Trait Const - Constant methods for crate::objdetect::CCheckerDetector
- CChecker
Trait - Mutable methods for crate::objdetect::CChecker
- CChecker
Trait Const - Constant methods for crate::objdetect::CChecker
- Charuco
Board Trait - Mutable methods for crate::objdetect::CharucoBoard
- Charuco
Board Trait Const - Constant methods for crate::objdetect::CharucoBoard
- Charuco
Detector Trait - Mutable methods for crate::objdetect::CharucoDetector
- Charuco
Detector Trait Const - Constant methods for crate::objdetect::CharucoDetector
- Charuco
Parameters Trait - Mutable methods for crate::objdetect::CharucoParameters
- Charuco
Parameters Trait Const - Constant methods for crate::objdetect::CharucoParameters
- Detector
Parameters Trait - Mutable methods for crate::objdetect::DetectorParameters
- Detector
Parameters Trait Const - Constant methods for crate::objdetect::DetectorParameters
- Dictionary
Trait - Mutable methods for crate::objdetect::Dictionary
- Dictionary
Trait Const - Constant methods for crate::objdetect::Dictionary
- Face
DetectorYN Trait - Mutable methods for crate::objdetect::FaceDetectorYN
- Face
DetectorYN Trait Const - Constant methods for crate::objdetect::FaceDetectorYN
- Face
RecognizerSF Trait - Mutable methods for crate::objdetect::FaceRecognizerSF
- Face
RecognizerSF Trait Const - Constant methods for crate::objdetect::FaceRecognizerSF
- Graphical
Code Detector Trait - Mutable methods for crate::objdetect::GraphicalCodeDetector
- Graphical
Code Detector Trait Const - Constant methods for crate::objdetect::GraphicalCodeDetector
- Grid
Board Trait - Mutable methods for crate::objdetect::GridBoard
- Grid
Board Trait Const - Constant methods for crate::objdetect::GridBoard
- QRCode
Detector Aruco Trait - Mutable methods for crate::objdetect::QRCodeDetectorAruco
- QRCode
Detector Aruco Trait Const - Constant methods for crate::objdetect::QRCodeDetectorAruco
- QRCode
Detector Trait - Mutable methods for crate::objdetect::QRCodeDetector
- QRCode
Detector Trait Const - Constant methods for crate::objdetect::QRCodeDetector
- QRCode
Encoder Trait - Mutable methods for crate::objdetect::QRCodeEncoder
- QRCode
Encoder Trait Const - Constant methods for crate::objdetect::QRCodeEncoder
Functions§
- check_
chessboard - Checks whether the image contains chessboard of the specific size or not.
- draw_
chessboard_ corners - Renders the detected chessboard corners.
- draw_
detected_ corners_ charuco - Draws a set of Charuco corners
- draw_
detected_ corners_ charuco_ def - Draws a set of Charuco corners
- draw_
detected_ diamonds - Draw a set of detected ChArUco Diamond markers
- draw_
detected_ diamonds_ def - Draw a set of detected ChArUco Diamond markers
- draw_
detected_ markers - Draw detected markers in image
- draw_
detected_ markers_ def - Draw detected markers in image
- estimate_
chessboard_ sharpness - Estimates the sharpness of a detected chessboard.
- estimate_
chessboard_ sharpness_ def - Estimates the sharpness of a detected chessboard.
- extend_
dictionary - Extend base dictionary by new nMarkers
- extend_
dictionary_ def - Extend base dictionary by new nMarkers
- find4_
quad_ corner_ subpix - finds subpixel-accurate positions of the chessboard corners
- find_
chessboard_ corners - Finds the positions of internal corners of the chessboard.
- find_
chessboard_ corners_ def - Finds the positions of internal corners of the chessboard.
- find_
chessboard_ corners_ sb - Finds the positions of internal corners of the chessboard using a sector based approach.
- find_
chessboard_ corners_ sb_ def - Finds the positions of internal corners of the chessboard using a sector based approach.
- find_
chessboard_ corners_ sb_ with_ meta - Finds the positions of internal corners of the chessboard using a sector based approach.
- find_
circles_ grid - Finds centers in the grid of circles.
- find_
circles_ grid_ def - Finds centers in the grid of circles.
- find_
circles_ grid_ with_ params - Finds centers in the grid of circles.
- generate_
image_ marker - Generate a canonical marker image
- generate_
image_ marker_ def - Generate a canonical marker image
- get_
predefined_ dictionary - Returns one of the predefined dictionaries defined in PredefinedDictionaryType
- get_
predefined_ dictionary_ i32 - Returns one of the predefined dictionaries referenced by DICT_*.