opencv 從畫素座標得到世界座標系座標
阿新 • • 發佈:2020-10-25
文章目錄
座標變換詳解
1.1 座標關係
相機中有四個座標系,分別為world,camera,image,pixel
- world為世界座標系,可以任意指定軸和軸,為上圖P點所在座標系。
- camera為相機座標系,原點位於小孔,z軸與光軸重合,軸和軸平行投影面,為上圖座標系。
- image為影象座標系,原點位於光軸和投影面的交點,軸和軸平行投影面,為上圖座標系。
- pixel為畫素座標系,從小孔向投影面方向看,投影面的左上角為原點,uv軸和投影面兩邊重合,該座標系與影象座標系處在同一平面,但原點不同。
座標轉換
下式為畫素座標pixel與世界座標world的轉換公式,左側第一個矩陣為相機內參數矩陣,第二個矩陣為相機外引數矩陣。假設影象座標已知,同時相機內參數矩陣通過標定已獲取,還需計算比例係數s和外引數矩陣。
s [ u v 1 ] = [ f x 0 c x 0 f y c y 0 0 1 ] [ r 11 r 12 r 13 t 1 r 21 r 22 r 23 t 2 r 31 r 32 r 33 t 3 ] [ x y z 1 ] s \left[
\right] =\left[
fx00amp;0amp;fyamp;0amp;cxamp;cyamp;1fxamp;0amp;cx0amp;fyamp;cy0amp;0amp;1\right] \left[
r11r21r31amp;r12amp;r22amp;r32amp;r13amp;r23amp;r33amp;t1amp;t2amp;t3r11amp;r12amp;r13amp;t1r21amp;r22amp;r23amp;t2r31amp;r32amp;r33amp;t3\right] \left[
xyz1xyz1\right]s⎣⎡uv1⎦⎤=⎣⎡fx000fy0cxcy1⎦⎤⎣⎡