|
2 | 2 | ==== |
3 | 3 |
|
4 | 4 | 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. |
5 | | -The output message is a :ref:`MessageGroup` containing synchronized messages from all the input streams. These can be demultiplexed using the :ref:`Demux` node. |
| 5 | +The output message is a :ref:`MessageGroup` containing synchronized messages from all the input streams. These can be demultiplexed using the :ref:`MessageDemux` node. |
6 | 6 |
|
7 | | -How to Use |
8 | | -########## |
| 7 | +How to Place it |
| 8 | +############### |
9 | 9 |
|
10 | 10 | .. tabs:: |
11 | 11 |
|
12 | 12 | .. code-tab:: py |
13 | 13 |
|
14 | 14 | pipeline = dai.Pipeline() |
15 | | - sync = pipeline.create(dai.node.MessageDemux) |
16 | | - |
17 | | - # Configure threshold for timestamp alignment |
18 | | - sync.setSyncThreshold(timedelta(milliseconds=50)) |
19 | | - |
20 | | - # Configure inputs to be synchronized |
21 | | - sync.inputs["input1"] |
22 | | - sync.inputs["input2"] |
23 | | - |
24 | | - # ... |
| 15 | + sync = pipeline.create(dai.node.Sync) |
25 | 16 |
|
26 | 17 | .. code-tab:: c++ |
27 | 18 |
|
28 | 19 | dai::Pipeline pipeline; |
29 | | - auto sync = pipeline.create<dai::node::MessageDemux>(); |
30 | | - |
31 | | - // Configure threshold for timestamp alignment |
32 | | - sync->setSyncThreshold(std::chrono::milliseconds(50)); |
33 | | - |
34 | | - // Configure inputs to be synchronized |
35 | | - sync->inputs["input1"]; |
36 | | - sync->inputs["input2"]; |
37 | | - |
38 | | - // ... |
| 20 | + auto sync = pipeline.create<dai::node::Sync>(); |
39 | 21 |
|
40 | 22 |
|
41 | 23 | Inputs and Outputs |
@@ -65,6 +47,43 @@ Message Synchronization |
65 | 47 | The Sync node aligns incoming messages based on their timestamps. The synchronization criteria and behavior can be configured using the :code:`depthai.node.Sync.setSyncThreshold` and :code:`depthai.node.Sync.setSyncAttempts` method. More info in the :ref:`API Reference <reference>`. |
66 | 48 |
|
67 | 49 |
|
| 50 | +Usage |
| 51 | +##### |
| 52 | + |
| 53 | +.. tabs:: |
| 54 | + |
| 55 | + .. code-tab:: py |
| 56 | + |
| 57 | + pipeline = dai.Pipeline() |
| 58 | + sync = pipeline.create(dai.node.Sync) |
| 59 | + |
| 60 | + # Configure threshold for timestamp alignment |
| 61 | + sync.setSyncThreshold(timedelta(milliseconds=50)) |
| 62 | + |
| 63 | + # Configure inputs to be synchronized |
| 64 | + camRgb.video.link(sync.inputs["input1"]) |
| 65 | + stereo.depth.link(sync.inputs["input2"]) |
| 66 | + |
| 67 | + sync.output.link(xout.input) |
| 68 | + # ... |
| 69 | + |
| 70 | + .. code-tab:: c++ |
| 71 | + |
| 72 | + dai::Pipeline pipeline; |
| 73 | + auto sync = pipeline.create<dai::node::Sync>(); |
| 74 | + |
| 75 | + // Configure threshold for timestamp alignment |
| 76 | + sync->setSyncThreshold(std::chrono::milliseconds(50)); |
| 77 | + |
| 78 | + // Configure inputs to be synchronized |
| 79 | + camRgb.video.link(sync->input["input1"]); |
| 80 | + stereo.depth.link(sync->input["input2"]); |
| 81 | + |
| 82 | + sync->out.link(xout.input); |
| 83 | + // ... |
| 84 | + |
| 85 | + |
| 86 | + |
68 | 87 | Examples of Functionality |
69 | 88 | ########################## |
70 | 89 |
|
|
0 commit comments