問題描述
我正在使用 tsai algo 進(jìn)行相機(jī)校準(zhǔn).我得到了內(nèi)在和外在矩陣,但如何從該信息重建 3D 坐標(biāo)?
I am doing camera calibration from tsai algo. I got intrensic and extrinsic matrix, but how can I reconstruct the 3D coordinates from that inormation?
1) 我可以使用高斯消元法找到 X、Y、Z、W,然后點(diǎn)將是 X/W 、 Y/W 、 Z/W 作為齊次系統(tǒng).
1) I can use Gaussian Elimination for find X,Y,Z,W and then points will be X/W , Y/W , Z/W as homogeneous system.
2) 我可以使用OpenCV 文檔方法:
2) I can use the
OpenCV documentation approach:
據(jù)我所知 u
, v
, R
, t
,我可以計(jì)算 X,Y,Z
.
as I know u
, v
, R
, t
, I can compute X,Y,Z
.
然而,這兩種方法最終都會(huì)得到不正確的不同結(jié)果.
However both methods end up in different results that are not correct.
我做錯(cuò)了什么?
推薦答案
如果您有外部參數(shù),那么您就擁有了一切.這意味著您可以從外在變量(也稱為 CameraPose)獲得 Homography.Pose是一個(gè)3x4的矩陣,homography是一個(gè)3x3的矩陣,H定義為
If you got extrinsic parameters then you got everything. That means that you can have Homography from the extrinsics (also called CameraPose). Pose is a 3x4 matrix, homography is a 3x3 matrix, H defined as
H = K*[r1, r2, t], //eqn 8.1, Hartley and Zisserman
其中K是相機(jī)內(nèi)在矩陣,r1和r2是旋轉(zhuǎn)矩陣的前兩列,R強(qiáng)>;t 是平移向量.
with K being the camera intrinsic matrix, r1 and r2 being the first two columns of the rotation matrix, R; t is the translation vector.
然后將所有內(nèi)容除以 t3 歸一化.
Then normalize dividing everything by t3.
r3 列會(huì)發(fā)生什么,我們不使用它嗎?不,因?yàn)樗嵌嘤嗟模驗(yàn)樗亲藙?shì)的前 2 列的叉積.
What happens to column r3, don't we use it? No, because it is redundant as it is the cross-product of the 2 first columns of pose.
既然你有了單應(yīng)性,就投影點(diǎn).你的 2d 點(diǎn)是 x,y.將它們添加為 z=1,因此它們現(xiàn)在是 3d.按如下方式對(duì)其進(jìn)行投影:
Now that you have homography, project the points. Your 2d points are x,y. Add them a z=1, so they are now 3d. Project them as follows:
p = [x y 1];
projection = H * p; //project
projnorm = projection / p(z); //normalize
希望這會(huì)有所幫助.
這篇關(guān)于如果已知外在和內(nèi)在參數(shù),則從 2D 圖像像素獲取 3D 坐標(biāo)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!