此页面由 AI 自动翻译。查看英文原版
最后更新

本页目录

  • 如何放置
  • 输入和输出
  • 限制
  • 功能示例
  • 参考
Claude CodeCodexCursor
Luxonis 智能体工具包为你常用的编程智能体加载 Luxonis 上下文与技能,更快地基于 OAK 开发应用。
安装工具包
最后更新
Supported on:RVC2RVC4
AprilTag 节点将 ImgFrame 作为输入,并输出检测到的 AprilTag 标记(AprilTags 消息)。它基于 AprilRobotics/apriltag 仓库,并在 CPU 上运行优化的检测算法(在 RVC4 八核本身上,或在使用基于 RVC2 的设备时在主机上)。AprilTag 标记是一种视觉 基准标记,因此它类似于 ArUco、ARTag 和 ARToolKit 标记。

如何放置

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

C++

C++
1dai::Pipeline pipeline;
2auto cameraNode = pipeline.create<dai::node::Camera>()->build();
3auto aprilTagNode = pipeline.create<dai::node::AprilTag>();
4// Link 1920x1080 output to AprilTag input
5auto outputCam = cameraNode->requestOutput(std::make_pair(1920, 1080));
6outputCam->link(aprilTagNode->inputImage);
7// Create output queue for passthrough frames
8auto passthroughOutputQueue = aprilTagNode->passthroughInputImage.createOutputQueue();
9// Create output queue for detected AprilTags
10auto outQueue = aprilTagNode->out.createOutputQueue();

输入和输出

限制

RVC2

在 RVC2 设备上,AprilTag 节点在主机上运行,因此性能将受主机 CPU 限制。

RVC4

RVC4 可以以大约 190FPS 的速度处理 1080P 帧,同时消耗 25% 的 CPU。我们使用 此脚本 来测试性能,结果如下:
Command Line
1[441340706] [10.12.101.114] [1725552371.591] [BenchmarkIn(3)] [warning] FPS: 191.80461
2[441340706] [10.12.101.114] [1725552371.592] [BenchmarkIn(3)] [warning] Messages took 52.13639 s
3[441340706] [10.12.101.114] [1725552371.593] [BenchmarkIn(3)] [warning] Average latency is 0 s

功能示例

参考

class

dai::node::AprilTag

#include AprilTag.hpp
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
Output out
Outputs AprilTags message that carries spatial location results.
variable
Output outConfig
Outputs AprilTagConfig message that contains current configuration.
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()
Get whether or not wait until configuration message arrives to inputConfig Input.
function
void setNumThreads(int numThreads)
Set number of threads to use for AprilTag detection.
Parameters
  • numThreads: Number of threads to use.
function
int getNumThreads()
Get number of threads to use for AprilTag detection.
Returns
Number of threads to use.
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()
Function called from within the create function to build the node. This function is useful for initialization, setting up inputs and outputs = stuff that cannot be perform in the constuctor.
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)

需要帮助?

请访问讨论论坛以获取技术支持或您可能有的任何其他问题。