DepthAI v2 has been superseded by DepthAI v3. You are viewing legacy documentation.
此页面由 AI 自动翻译。查看英文原版
最后更新

本页目录

  • How to Place it
  • Inputs and Outputs
  • Message Synchronization
  • Sync Logic
  • Usage
  • Examples of Functionality
  • Reference
Claude CodeCodexCursor
Luxonis 智能体工具包为你常用的编程智能体加载 Luxonis 上下文与技能,更快地基于 OAK 开发应用。
安装工具包
最后更新
The Sync node is used for synchronizing multiple input streams based on their timestamps. It outputs a grouped message containing synchronized frames from the input streams. The output message is a MessageGroup containing synchronized messages from all the input streams. These can be demultiplexed using the MessageDemux node.

How to Place it

Python

Python
1pipeline = dai.Pipeline()
2sync = pipeline.create(dai.node.Sync)

C++

C++
1dai::Pipeline pipeline;
2auto sync = pipeline.create<dai::node.Sync>();

Inputs and Outputs

Message Synchronization

The Sync node aligns incoming messages based on their timestamps. The synchronization criteria and behavior can be configured using the depthai.node.Sync.setSyncThreshold and depthai.node.Sync.setSyncAttempts method. More info in the Reference section.

Sync Logic

Usage

Python

Python
1pipeline = dai.Pipeline()
2sync = pipeline.create(dai.node.Sync)
3
4# Configure threshold for timestamp alignment
5sync.setSyncThreshold(timedelta(milliseconds=50))
6
7# Configure inputs to be synchronized
8camRgb.video.link(sync.inputs["input1"])
9stereo.depth.link(sync.inputs["input2"])
10
11sync.out.link(xout.input)
12# ...

C++

C++
1dai::Pipeline pipeline;
2auto sync = pipeline.create<dai::node.Sync>();
3
4// Configure threshold for timestamp alignment
5sync->setSyncThreshold(std::chrono::milliseconds(50));
6
7// Configure inputs to be synchronized
8camRgb.video.link(sync->input["input1"]);
9stereo.depth.link(sync->input["input2"]);
10
11sync->out.link(xout.input);
12# ...

Examples of Functionality

Reference

class

depthai.node.Sync(depthai.Node)

method
getProcessor(self) -> depthai.ProcessorType: depthai.ProcessorType
Get on which processor the node should run  Returns:     Processor type - Leon CSS or Leon MSS
method
getSyncAttempts(self) -> int: int
Gets the number of sync attempts
method
getSyncThreshold(self) -> datetime.timedelta: datetime.timedelta
Gets the maximal interval between messages in the group in milliseconds
method
setProcessor(self, arg0: depthai.ProcessorType)
Set on which processor the node should run  Parameter ``type``:     Processor type - Leon CSS or Leon MSS
method
setSyncAttempts(self, maxDataSize: typing.SupportsInt)
Set the number of attempts to get the specified max interval between messages in the group  Parameter ``syncAttempts``:     Number of attempts to get the specified max interval between messages in the     group: - if syncAttempts = 0 then the node sends a message as soon at the     group is filled - if syncAttempts > 0 then the node will make syncAttemts     attempts to synchronize before sending out a message - if syncAttempts = -1     (default) then the node will only send a message if successfully     synchronized
method
setSyncThreshold(self, syncThreshold: datetime.timedelta)
Set the maximal interval between messages in the group  Parameter ``syncThreshold``:     Maximal interval between messages in the group
property
inputs
A map of inputs
property
out
Output message of type MessageGroup

需要帮助?

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