ImFusion SDK 4.3
MarkerDetection Class Reference

#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...

Detailed Description

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 MarkerConfigurationmarkerConfiguration () 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
 

Member Function Documentation

◆ detections()

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.

Parameters
objectPoints3D corner coordinates in reference board
imagePoints2D image points corresponding to 3D corner points
pointIdsFor Aruco, Charuco, AprilTag and STag boards contains the marker Id of each point.
markerCornersFor Aruco, Charuco, AprilTag and STag boards, contains the four corner points for each detected marker
markerIdsFor Aruco, Charuco, AprilTag and STag boards, contains the ids of the detected markers in markerCorners. Can be different from pointIds.

◆ pose()

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.

Parameters
mreoptional output reprojection error
reprojectedPointsoptional output reprojected points
Returns
camera pose (zero matrix when the pose estimation failed)

◆ setSizeHint()

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.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close