標準カメラキャリブレーション
11 分
カメラキャリブレーションのフォーマットは https //docs opencv org/3 4/d4/d94/tutorial camera calibration html のフォーマットと https //www robots ox ac uk/ cmei/articles/single viewpoint calib mei 07 pdf に基づいています。サポートされているカメラタイプは、 pinhole 、 fisheye 、 kannala 、 principalpointdist 、 fusedcylindrical です。キャリブレーションモデルがサポートさ れていない場合は、webassemblyモジュールの形式で実装を提供する docid\ hg1krvpudpihysj2cl1ho を使用することもできます。 共通 すべてのカメラキャリブレーションには以下の属性があります。 キー 値 パラメータ rotation quaternion rotationquaternion オブジェクト w , x , y , z position position オブジェクト x , y , z camera matrix cameramatrix オブジェクト fx , fy , cx , cy image width 整数 なし image height 整数 なし field of view 浮動小数点数 なし pinhole pinhole カメラモデルは共通モデルを以下の属性で拡張します。 キー 値 パラメータ distortion coefficients distortioncoefficients オブジェクト k1 , k2 , p1 , p2 , k3 from kognic io model calibration camera common import cameramatrix, distortioncoefficients from kognic io model calibration camera pinhole calibration import pinholecalibration from kognic io model calibration common import position, rotationquaternion def unity pinhole calibration() camera position = position(x=0 0, y=0 0, z=0 0) camera rotation = rotationquaternion(w=1 0, x=0 0, y=0 0, z=0 0) camera camera matrix = cameramatrix(fx=3450, fy=3250, cx=622, cy=400) camera distortion coefficients = distortioncoefficients(k1=0 0, k2=0 0, p1=0 0, p2=0 0, k3=1 0) return pinholecalibration( position=camera position, rotation quaternion=camera rotation, camera matrix=camera camera matrix, distortion coefficients=camera distortion coefficients, image height=1080, image width=1920, field of view=190 0, ) fisheye fisheye カメラモデルは pinhole モデルを以下の属性で拡張します。 キー 値 パラメータ xi 浮動小数点数 なし from kognic io model calibration camera common import cameramatrix, distortioncoefficients from kognic io model calibration camera fisheye calibration import fisheyecalibration from kognic io model calibration common import position, rotationquaternion def unity fisheye calibration() camera position = position(x=0 0, y=0 0, z=0 0) camera rotation = rotationquaternion(w=1 0, x=0 0, y=0 0, z=0 0) camera camera matrix = cameramatrix(fx=3450, fy=3250, cx=622, cy=400) camera distortion coefficients = distortioncoefficients(k1=0 0, k2=0 0, p1=0 0, p2=0 0, k3=0 1) return fisheyecalibration( position=camera position, rotation quaternion=camera rotation, camera matrix=camera camera matrix, distortion coefficients=camera distortion coefficients, image height=1080, image width=1920, xi=123 456, field of view=190 0, ) kannala kannala カメラモデルは pinhole モデルを以下の変更と拡張を加えます。 キー 値 パラメータ distortion coefficients kannaladistortioncoefficients オブジェクト。歪みパラメータ k3 、 k4 が利用可能な場合、それぞれp1と p2 に割り当てることができます。つまり p1=k3 、 p2=k4 です。 k1 , k2 , p1 , p2 undistortion coefficients undistortioncoefficients オブジェクト l1 , l2 , l3 , l4 from kognic io model calibration camera common import cameramatrix from kognic io model calibration camera kannala calibration import ( kannalacalibration, kannaladistortioncoefficients, undistortioncoefficients, ) from kognic io model calibration common import position, rotationquaternion def unity kannala calibration() camera position = position(x=0 0, y=0 0, z=0 0) # similar to lidar camera rotation = rotationquaternion(w=1 0, x=0 0, y=0 0, z=0 0) # similar to lidar camera camera matrix = cameramatrix(fx=3450, fy=3250, cx=622, cy=400) camera distortion coefficients = kannaladistortioncoefficients(k1=0 0, k2=0 0, p1=0 0, p2=0 0) camera undistortion coefficients = undistortioncoefficients(l1=0 0, l2=0 0, l3=0 0, l4=0 0) return kannalacalibration( position=camera position, rotation quaternion=camera rotation, camera matrix=camera camera matrix, distortion coefficients=camera distortion coefficients, undistortion coefficients=camera undistortion coefficients, image height=1080, image width=1920, field of view=180 0, ) 主点歪み 主点歪みモデルは共通属性に加えて以下の属性で構成されます。 key value parameters principal point distortion coefficients principalpointdistortioncoefficients オブジェクト k1 , k2 lens projection coefficients (オプション。デフォルトはsf806モデルの値) lensprojectioncoefficients オブジェクト c1 , c2 , c3 , c4 , c5 , c6 distortion center distortioncenter オブジェクト x , y principal point principalpoint オブジェクト x , y from kognic io model calibration camera common import cameramatrix from kognic io model calibration camera principal point distortion calibration import ( distortioncenter, lensprojectioncoefficients, principalpoint, principalpointdistortioncalibration, principalpointdistortioncoefficients, ) from kognic io model calibration common import position, rotationquaternion def unity principal point distortion calibration() camera position = position(x=0 0, y=0 0, z=0 0) camera rotation = rotationquaternion(w=1 0, x=0 0, y=0 0, z=0 0) camera camera matrix = cameramatrix(fx=3450, fy=3250, cx=622, cy=400) camera distortion coefficients = principalpointdistortioncoefficients(k1=0 0, k2=0 0) principal point = principalpoint(x=0 0, y=0 0) distortion center = distortioncenter(x=0 0, y=0 0) lens projection coefficients = lensprojectioncoefficients(c1=0 0, c2=0 0, c3=0 0, c4=0 0, c5=0 0, c6=0 0) return principalpointdistortioncalibration( position=camera position, rotation quaternion=camera rotation, camera matrix=camera camera matrix, principal point distortion coefficients=camera distortion coefficients, lens projection coefficients=lens projection coefficients, principal point=principal point, distortion center=distortion center, image height=1080, image width=1920, field of view=180 0, ) フューズドシリンドリカル フューズドシリンドリカルモデルは共通属性に加えて以下の属性で構成されます。 キー 値 パラメータ cut angles degree cutangles オブジェクト。これらの角度は度数で表す必要があります。 upper , lower vertical fov degree (オプション。デフォルト72 5度) 浮動小数点数。この角度は度数で表す必要があります。 なし horizontal fov degree (optional default 93 degrees) 浮動小数点数。この角度は度数で表す必要があります。 なし max altitude angle degree (optional default 90 degrees) 浮動小数点数。この角度は度数で表す必要があります。 なし from kognic io model calibration camera common import cameramatrix from kognic io model calibration camera fused cylindrical calibration import cutangles, fusedcylindricalcalibration from kognic io model calibration common import position, rotationquaternion def example fused cylindrical calibration() camera position = position(x=0 0, y=0 0, z=0 0) camera rotation = rotationquaternion(w=1 0, x=0 0, y=0 0, z=0 0) camera camera matrix = cameramatrix(fx=400, fy=400, cx=600, cy=450) cut angles degree = cutangles(upper= 40 0, lower=30 0) return fusedcylindricalcalibration( position=camera position, rotation quaternion=camera rotation, camera matrix=camera camera matrix, image height=1080, image width=1920, cut angles degree=cut angles degree, vertical fov degree=70, horizontal fov degree=90 0, max altitude angle degree=90 0, ) シリンドリカル シリンドリカルモデルは共通属性のみで構成されます。このモデルには追加で設定する属性はありません。 from kognic io model calibration camera common import cameramatrix from kognic io model calibration camera cylindrical calibration import cylindricalcalibration from kognic io model calibration common import position, rotationquaternion def example cylindrical calibration() camera position = position(x=0 0, y=0 0, z=0 0) camera rotation = rotationquaternion(w=1 0, x=0 0, y=0 0, z=0 0) camera camera matrix = cameramatrix(fx=400, fy=400, cx=600, cy=450) return cylindricalcalibration( position=camera position, rotation quaternion=camera rotation, camera matrix=camera camera matrix, image height=1080, image width=1920, ) 主点フィッシュアイ 主点フィッシュアイモデルは共通属性に加えて以下の属性で構成されます。 キー 値 パラメータ principal point fisheye coefficients principalpointfisheyecoefficients オブジェクト alpha l , alpha r , beta u , beta l from kognic io model calibration camera common import cameramatrix from kognic io model calibration camera principal point fisheye calibration import ( principalpointfisheyecalibration, principalpointfisheyecoefficients, ) from kognic io model calibration common import position, rotationquaternion def unity principal point fisheye calibration() camera position = position(x=0 0, y=0 0, z=0 0) camera rotation = rotationquaternion(w=1 0, x=0 0, y=0 0, z=0 0) camera camera matrix = cameramatrix(fx=3450, fy=3250, cx=622, cy=400) principal point fisheye coefficients = principalpointfisheyecoefficients(alpha l=0 0, alpha r=0 0, beta u=0 0, beta l=0 0) return principalpointfisheyecalibration( position=camera position, rotation quaternion=camera rotation, camera matrix=camera camera matrix, principal point fisheye coefficients=principal point fisheye coefficients, image height=1080, image width=1920, field of view=180 0, )
