AprilTag
AprilTag node takes ImgFrame as input and outputs detected AprilTag markers (AprilTags message). It's based on the AprilRobotics/apriltag repository, and runs optimized detection algorithms on the CPU (on RVC4 octacore itself, or on the host when using RVC2-based devices).AprilTag marker is a visual fiducial marker, so it's similar to ArUco, ARTag and ARToolKit markers.How to place it
Python
C++
Python
Python
1pipeline = dai.Pipeline()
2hostCamera = pipeline.create(dai.node.Camera).build()
3aprilTagNode = pipeline.create(dai.node.AprilTag)
4# Link 1920x1080 output to AprilTag input
5hostCamera.requestOutput((1920, 1080)).link(aprilTagNode.inputImage)
6# Create output queue for passthrough frames
7passthroughOutputQueue = aprilTagNode.passthroughInputImage.createOutputQueue()
8# Create output queue for detected AprilTags
9outQueue = aprilTagNode.out.createOutputQueue()
Inputs and Outputs
Limitations
RVC2
RVC4
RVC2
On the RVC2 devices, the AprilTag node runs on the host computer, so the performance will be limited by the host CPU.Examples of functionality
Reference
class
dai::node::AprilTag
variable
std::shared_ptr< AprilTagConfig > initialConfig
Initial config to use when calculating spatial location data.
variable
Input inputConfig
Input AprilTagConfig message with ability to modify parameters in runtime. Default queue is non-blocking with size 4.
variable
Input inputImage
Input message with depth data used to retrieve spatial information about detected object. Default queue is non-blocking with size 4.
variable
variable
Output outConfig
variable
Output passthroughInputImage
Passthrough message on which the calculation was performed. Suitable for when input queue is set to non-blocking behavior.
function
AprilTag()
function
AprilTag(std::unique_ptr< Properties > props)
function
void setWaitForConfigInput(bool wait)
Specify whether or not wait until configuration message arrives to inputConfig Input.
Parameters
- wait: True to wait for configuration message, false otherwise.
function
bool getWaitForConfigInput()
function
void setNumThreads(int numThreads)
Set number of threads to use for AprilTag detection.
Parameters
- numThreads: Number of threads to use.
function
int getNumThreads()
function
void setRunOnHost(bool runOnHost)
Specify whether to run on host or device By default, the node will run on device.
function
bool runOnHost()
Check if the node is set to run on host
function
void run()
function
void buildInternal()
inline function
DeviceNodeCRTP()
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.