如何放置
Python
Python
1with dai.Pipeline() as pipeline:
2 img_align = pipeline.create(dai.node.ImageAlign)输入和输出
工作原理
input 帧并将其对齐到 inputAlignTo 帧。inputAlignTo 只读取一次以提取帧元数据,然后根据两个传感器之间的外参校准重新投影 input 帧并将其对齐。用法
Python
Python
1with dai.Pipeline() as pipeline:
2 rgb_cam = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_A)
3 video_stream = rgb_cam.requestOutput(size=(1280, 960))
4
5 # 创建左右立体相机和 StereoDepth 节点
6 left = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B)
7 right = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_C)
8 stereo = pipeline.create(dai.node.StereoDepth)
9
10 left.requestOutput(size=(640, 400)).link(stereo.left)
11 right.requestOutput(size=(640, 400)).link(stereo.right)
12
13 # 现在创建 ImageAlign 节点并将立体深度对齐到 RGB 流
14 img_align = pipeline.create(dai.node.ImageAlign)
15 stereo.depth.link(align.input)
16 video_stream.link(align.inputAlignTo)
17
18 # 如果您想拥有同步的对齐深度和彩色流,您需要使用 Sync 节点
19 sync = pipeline.create(dai.node.Sync)
20 img_align.outputAligned.link(sync.inputs['aligned_depth'])
21 video_stream.link(sync.inputs["color"])
22
23 # 创建一个输出队列,以便您可以将同步帧获取到主机计算机
24 queue = sync.out.createOutputQueue()
25
26 # ...功能示例
- 深度对齐 - 对齐并融合 RGB 和深度帧。
参考
class
dai::node::ImageAlign
variable
std::shared_ptr< ImageAlignConfig > initialConfig
Initial config to use when calculating spatial location data.
variable
Input inputConfig
Input message with ability to modify parameters in runtime. Default queue is non-blocking with size 4.
variable
Input input
Input message. Default queue is non-blocking with size 4.
variable
Input inputAlignTo
Input align to message. Default queue is non-blocking with size 1.
variable
variable
Output passthroughInput
Passthrough message on which the calculation was performed. Suitable for when input queue is set to non-blocking behavior.
function
ImageAlign & setOutputSize(int alignWidth, int alignHeight)Specify the output size of the aligned image
function
ImageAlign & setOutKeepAspectRatio(bool keep)Specify whether to keep aspect ratio when resizing
function
ImageAlign & setInterpolation(Interpolation interp)Specify interpolation method to use when resizing
function
ImageAlign & setNumShaves(int numShaves)Specify number of shaves to use for this node
function
ImageAlign & setNumFramesPool(int numFramesPool)Specify number of frames in the pool
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()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)需要帮助?
请访问讨论论坛以获取技术支持或您可能有的任何其他问题。