0
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?

More than 3 years have passed since last update.

librealsenseでのカメラ情報取得

Last updated at Posted at 2021-10-20

(注)自分用の備忘録なので体裁とかは適当です

カメラの視野角とかを取得したいとき

・まずはpipelineを宣言してスタート

rs2::pipeline pipe;
rs2::config cfg;
cfg.enable_stream(RS2_STREAM_DEPTH, 640, 480, RS2_FORMAT_Z16, 30);
cfg.enable_stream(RS2_STREAM_COLOR, 640, 480, RS2_FORMAT_BGR8, 30);
rs2::pipeline_profile profile = pipe.start(cfg);

・赤外線カメラの情報を取得したいときは

rs2_intrinsics ntrinsics = profile.get_stream(RS2_STREAM_DEPTH).as<rs2::video_stream_profile>().get_intrinsics();

rs2_intrinsics型は構造体であり,メンバ変数に画像サイズや焦点距離などを保持している(詳細はここ).
例えば縦幅と焦点距離から垂直視野角を計算したいときは以下のようになる.

float height = intrinsics.height;
float fy = intrinsics.fy;
float fovy = atan(height / (2. * fy))

ここでfovyはラジアンとなることに注意.

0
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
0
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?