![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Vision/MarkerDetection.h>
Generic marker detection class for a wide range of marker types, such as Aruco, Charuco, Chessboard, Circle Board, AprilTag and STag. More...
Generic marker detection class for a wide range of marker types, such as Aruco, Charuco, Chessboard, Circle Board, AprilTag and STag.
Public Types | |
| enum class | ComputeDevice { GPU , CPU } |
Public Member Functions | |
| void | setMarkerConfiguration (const MarkerConfiguration &markerConfig) |
| Set marker configuration for the marker detection. | |
| const MarkerConfiguration & | markerConfiguration () const |
| void | setPrintMarkerConfigurationErrors (bool v) |
| Specify whether errors regarding wrong marker configuration should be logged. Makes sense to disable when marker configuration is changed during live marker detection. | |
| bool | printMarkerConfigurationErrors () |
| void | setRemoveDuplicateMarkers (bool v) |
| Set duplicate marker removal. | |
| bool | removeDuplicateMarkers () const |
| Get duplicate marker removal status. | |
| void | setInpaintCharucoMarkersRefinementWindowSize (int refinementSize=0) |
| Controll whether to do a second corner refinement for Charuco boards after inpainting the markers in the image. | |
| int | inpaintCharucoMarkersRefinementWindowSize (int refinementSize=0) |
| void | setComputeDevice (ComputeDevice computeDevice) |
| Set compute device for charuco marker inpainting. Defaults to CPU. Use GPU only when not running in parallel threads. | |
| ComputeDevice | computeDevice () const |
| void | setCameraParameters (const mat3 &K, const Eigen::Matrix< double, 5, 1 > &dist) |
| Set camera parameters. | |
| bool | detectMarker (const SharedImage *image, SharedImage *detectionImage=nullptr) |
| Run marker detection on provided image detectionImage is an optional output which must have the same size as the input image (typically a copy of the input) onto which the detections are rendered. | |
| void | detections (std::vector< vec3 > &objectPoints, std::vector< vec2 > &imagePoints, std::vector< int > *pointIds=nullptr, std::vector< std::vector< vec2 > > *markerCorners=nullptr, std::vector< int > *markerIds=nullptr) const |
| Obtain extracted marker parameters. | |
| mat4 | pose (double *mre=nullptr, std::vector< vec2 > *reprojectedPoints=nullptr) |
| Estimate camera pose (i.e. | |
| void | setSizeHint (vec2i ll, vec2i ur) |
| Set size hint of bounds we think contain the markers. | |
| void | setDetectSizeHintAutomatically (bool v) |
| If set to true and if not all markers were detected during the first time, the marker detection will run the second time with a cropped image that has a center in a bounding box of detected markers and with double the size of the longer side of the bounding box Note: currently implemented only for Charuco board Warning: provided size hint is ignored if this flag is set. | |
| bool | detectSizeHintAutomatically () const |
| void detections | ( | std::vector< vec3 > & | objectPoints, |
| std::vector< vec2 > & | imagePoints, | ||
| std::vector< int > * | pointIds = nullptr, | ||
| std::vector< std::vector< vec2 > > * | markerCorners = nullptr, | ||
| std::vector< int > * | markerIds = nullptr ) const |
Obtain extracted marker parameters.
| objectPoints | 3D corner coordinates in reference board |
| imagePoints | 2D image points corresponding to 3D corner points |
| pointIds | For Aruco, Charuco, AprilTag and STag boards contains the marker Id of each point. |
| markerCorners | For Aruco, Charuco, AprilTag and STag boards, contains the four corner points for each detected marker |
| markerIds | For Aruco, Charuco, AprilTag and STag boards, contains the ids of the detected markers in markerCorners. Can be different from pointIds. |
| mat4 pose | ( | double * | mre = nullptr, |
| std::vector< vec2 > * | reprojectedPoints = nullptr ) |
Estimate camera pose (i.e.
transformation from world to camera). Requires camera parameters to have been set.
| mre | optional output reprojection error |
| reprojectedPoints | optional output reprojected points |
| void setSizeHint | ( | vec2i | ll, |
| vec2i | ur ) |
Set size hint of bounds we think contain the markers.
For some detections we first crop to these bounds and see if we find marker there.