ImageAlign
ImageAlign node is used for aligning sensor frames, like depth map (from ToF/Stereo) to color frame (RGB-D), or to align temperature/thermal frame to color frame (RGB-Thermal) when specifying depth plane.How to place it
Python
C++
Python
Python
1with dai.Pipeline() as pipeline:
2 img_align = pipeline.create(dai.node.ImageAlign)
Inputs and Outputs
How it works
ImageAlign alignsinput
frame and aligns it to inputAlignTo
frame. The inputAlignTo
is only read once to extract the frame metadata, then the input
frame is reprojected and aligned to it based on the extrinsic calibration between the two sensors.Usage
Python
C++
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 # Create left/right stereo cameras & StereoDepth node
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 # Now create ImageAlign node and align stereo depth to RGB stream
14 img_align = pipeline.create(dai.node.ImageAlign)
15 stereo.depth.link(align.input)
16 video_stream.link(align.inputAlignTo)
17
18 # If you want to have synchronized aligned depth and color stream, you'd want to use Sync node
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 # Create an output queue, so you can get sycned frames to the host computer
24 queue = sync.out.createOutputQueue()
25
26 # ...
Examples of functionality
Reference
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
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.