Software Stack
DepthAI
  • DepthAI Components
    • AprilTags
    • Benchmark
    • Camera
    • Calibration
    • DetectionNetwork
    • EdgeDetector
    • Events
    • FeatureTracker
    • HostNodes
    • ImageAlign
    • ImageManip
    • IMU
    • Misc
    • Model Zoo
    • NeuralNetwork
    • ObjectTracker
    • RecordReplay
    • RGBD
    • Script
    • SpatialDetectionNetwork
    • SpatialLocationCalculator
    • StereoDepth
    • Sync
    • SystemLogger
    • VideoEncoder
    • Visualizer
    • Warp
    • RVC2-specific
  • Advanced Tutorials
  • API Reference
  • Tools

ON THIS PAGE

  • Sync
  • Pipeline
  • Source code

Sync

This example shows how to synchronize two video streams, each coming from a different camera.This example requires the DepthAI v3 API, see installation instructions.

Pipeline

Source code

Python
C++

Python

Python
GitHub
1import depthai as dai
2
3pipeline = dai.Pipeline()
4left = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B)
5right = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_C)
6
7
8sync = pipeline.create(dai.node.Sync)
9sync.setRunOnHost(True) # Can also run on device
10left.requestFullResolutionOutput().link(sync.inputs["left"])
11right.requestFullResolutionOutput().link(sync.inputs["right"])
12
13outQueue = sync.out.createOutputQueue()
14pipeline.start()
15
16
17while pipeline.isRunning():
18    messageGroup : dai.MessageGroup = outQueue.get()
19    left = messageGroup["left"]
20    right = messageGroup["right"]
21    print(f"Timestamps, message group {messageGroup.getTimestamp()}, left {left.getTimestamp()}, right {right.getTimestamp()}")

Need assistance?

Head over to Discussion Forum for technical support or any other questions you might have.