1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ZED SDK のtimestampを取得するには

Last updated at Posted at 2024-03-13

想定する読者

stereolabsのzed2, zed mini, zed x などのステレオカメラの利用者
いまどきのステレオカメラは何ができるのかを知りたい人

前提

ZED SDK 4.0

retrieveしたデータ構造にはTimestamp クラスのインスタンスがある。
そこから時刻の値を取得するには、以下のメソッドを用いる。

get_nanoseconds()
get_microseconds()
get_millisecond()
get_seconds()

point_cloud.timestamp.get_nanoseconds()

公式ドキュメント

python(linux) のtime.time() 関数との比較

.py
        zed.retrieve_image(left_image, sl.VIEW.LEFT)
        unix_seconds = time.time()
        left_seconds = left_image.timestamp.get_seconds()
        left_nanoseconds = left_image.timestamp.get_nanoseconds()
        print(f"{left_seconds=}")
        print(f"{left_nanoseconds * 1e-9 =}")
        print(f"{unix_seconds=}")
        print(f"{int(unix_seconds) == left_seconds =}")

出力例

left_seconds=1711353324
left_nanoseconds * 1e-9 =1711353324.098794
unix_seconds=1711353324.2152798
int(unix_seconds) == left_seconds =True
  • Linux の場合はZED SDK のtimestamp のEpoch は Unix のEpoch に一致している。
  • この例では、JetsonのLinux のtimerの秒数と、ZED2i のカメラの中のtimerの秒数とが整数部で一致した。
  • 1秒未満を合わせようとすれば、NTPを使うことは必須のようだ。

ZEDの時刻をNTP出会わせるには?

公式ドキュメント Setting up Multiple Cameras on a Local Network

ユーザーの皆さんには確かめてみてほしいこと

  1. retrieve できる対象について、即座のそれぞれretrieveする。
  2. その後個別にget_data() したときにデータの整合性をもっているのかどうかという確認。
    例:retreive_measureしたpint_cloud中にある各点の色情報が、retrieve_imageした左画像の色情報と一致しているかの確認。
.py
zed.retrieve_image(image, sl.VIEW.LEFT, sl.MEM.CPU, display_resolution)
zed.retrieve_measure(point_cloud, sl.MEASURE.XYZRGBA, sl.MEM.CPU, point_cloud_res)
xyz_data = point_cloud.get_data()


zed.retrieve_measure(point_cloud, sl.MEASURE.XYZRGBA, sl.MEM.CPU, point_cloud_res)
xyz_data = point_cloud.get_data()

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?