• DepthAI-v2
  • Synchronize between RGB camera and stereo camera?

Is there a way to synchronize between RGB camera and stereo camera? We're using the stereo camera together with the IMU to produce odometry and using the RGB camera to do visual localization. If we want to fuse them together, it is best their timestamps are synchronized.

Thanks!
Dong

  • erik replied to this.

    Hello Dong_Liu , you can sync them either via timestamps (msg.getTimestamp()) or by sequence numbers (msg.getSeqNum()) if both cameras are set to the same FPS. See demo here.
    Thanks, Erik

    Thanks, Erik. So If I understand correctly. The timestamps of rgb and stereo camera are based on the same clock, right?

    • erik replied to this.

      Dong_Liu yes, and that clock is actually host clock. So if you have multiple OAK cameras, they will all have the same timestamp clock for all frames, so you can sync multiple streams from multiple OAK cameras with the getTimestamp() approach.
      Thanks, Erik

      Erik, thanks!

      Another question, how can i sync the OAK-D frame with other sensor? What is the relation between getTimestamp() and the Unix Epoch Time, that is return from time.time()?

      The document says getTimestamp() "Retrieves image timestamp related to dai::Clock::now()" which is not very clear to me.

      I tried to print the value this way,
      print(f'frame time:{inRgb.getTimestamp().total_seconds()} system time:{time.time()}')

      I got,

      frame time:34903.997688 system time:1646176426.1729233

      It looks the the timestamp is since the machine reboot, is that right. So I can get the constant shift by

      shift = time.time() - depthai.Clock.now().total_seconds()

      Then add the shift to getTimestamp() to get the timestamp in the unix epoch time. Right?

      • erik replied to this.