DepthAI v2 has been superseded by DepthAI v3. You are viewing legacy documentation.

本页目录

  • 如何放置
  • 输入和输出
  • 消息同步
  • 同步逻辑
  • 使用示例
  • 功能示例
  • 参考

同步

同步节点用于根据时间戳同步多个输入流。它会输出一个包含来自各输入流的同步帧的分组消息。 输出消息是一个 MessageGroup,包含所有输入流的同步消息。这些消息可以使用 MessageDemux 节点进行解复用。

如何放置

Python

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

C++

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

输入和输出

消息同步

同步节点根据时间戳对齐传入的消息。同步条件和行为可以通过 depthai.node.Sync.setSyncThresholddepthai.node.Sync.setSyncAttempts 方法进行配置。更多信息请参见 参考部分

同步逻辑

使用示例

Python

Python
1pipeline = dai.Pipeline()
2sync = pipeline.create(dai.node.Sync)
3
4# 配置时间戳对齐阈值
5sync.setSyncThreshold(timedelta(milliseconds=50))
6
7# 配置需要同步的输入
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// 配置时间戳对齐阈值
5sync->setSyncThreshold(std::chrono::milliseconds(50));
6
7// 配置需要同步的输入
8camRgb.video.link(sync->input["input1"]);
9stereo.depth.link(sync->input["input2"]);
10
11sync->out.link(xout.input);
12// ...

功能示例

参考

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

需要帮助?

请前往 OAKChina 官网 获取技术支持或解答您的任何疑问。