Azure Kinect のキャリブレーションデータを取得する
Azure Kinect とOpenCVを組み合わせたくて、カメラの歪みパラメータ(Distortion Coefficients/Intrinsic Parameters)を取得した。
マーカーボードを使って自分でやらなくても、デバイスから値が取得できる。(便利)
azure-kinect-sensor-sdkに パラメータ取得のためのサンプルがあるのでそれを実行。
- Azure-Kinect-Sensor-SDK/examples/calibration at develop · microsoft/Azure-Kinect-Sensor-SDK · GitHub
SDKのビルドはここが参考になった。(Visual Studio 2017でCmakeList.txtを読み込んでビルドするだけ)
- Azure Kinect Sensor SDK (メモ) | ブチザッキ
- Azure-Kinect-Sensor-SDK/building.md at develop · microsoft/Azure-Kinect-Sensor-SDK · GitHub
ビルドすると、calibration_info.exeが生成される。 AzureKinectを接続して実行すると以下のように出力される。
C:\GitHub\Azure-Kinect-Sensor-SDK\build\Win-x64-Release-Ninja\bin>calibration_info.exe > out.txt
Found 1 connected devices: ===== Device 0: {DeviceID:XXXXXX} ===== resolution width: 640 resolution height: 576 principal point x: 309.301086 principal point y: 330.656738 focal length x: 505.119751 focal length y: 505.163605 radial distortion coefficients: k1: 3.063722 k2: 1.988396 k3: 0.102371 k4: 3.397454 k5: 2.984188 k6: 0.544097 center of distortion in Z=1 plane, x: 0.000000 center of distortion in Z=1 plane, y: 0.000000 tangential distortion coefficient x: -0.000098 tangential distortion coefficient y: 0.000048 metric radius: 0.000000
ただし、このデフォルト状態だと、K4A_DEPTH_MODE_NFOV_UNBINNEDの Depthカメラのキャリブレーション情報となる.
RGBカメラの値を取得したい場合は
auto calib = calibration.depth_camera_calibration;
を
auto calib = calibration.color_camera_calibration;
変えるなど調整が必要
1080pのRGBカメラの場合は
Found 1 connected devices: ===== Device 0: {DeviceID:XXXXXX} ===== resolution width: 1920 resolution height: 1080 principal point x: 968.939209 principal point y: 558.608459 focal length x: 899.693420 focal length y: 899.449646 radial distortion coefficients: k1: 0.678679 k2: -2.779486 k3: 1.569404 k4: 0.554819 k5: -2.610379 k6: 1.500811 center of distortion in Z=1 plane, x: 0.000000 center of distortion in Z=1 plane, y: 0.000000 tangential distortion coefficient x: 0.000476 tangential distortion coefficient y: 0.000104 metric radius: 0.000000
720pのRGBカメラの場合は
Found 1 connected devices: ===== Device 0: {DeviceID:XXXXXX} ===== resolution width: 1280 resolution height: 720 principal point x: 645.792786 principal point y: 372.238983 focal length x: 599.795593 focal length y: 599.633118 radial distortion coefficients: k1: 0.678679 k2: -2.779486 k3: 1.569404 k4: 0.554819 k5: -2.610379 k6: 1.500811 center of distortion in Z=1 plane, x: 0.000000 center of distortion in Z=1 plane, y: 0.000000 tangential distortion coefficient x: 0.000476 tangential distortion coefficient y: 0.000104 metric radius: 0.000000
となった。