如何放置
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)需要帮助?
请前往 OAKChina 官网 获取技术支持或解答您的任何疑问。