我一直在尝试计算一个物体和我的一个相机(相同型号)之间的距离。校准后,成功得到如下矩阵。分辨率为 600 x 480。
Left Camera Matrix
[[624.65871068 0. 279.196958 ]
[ 0. 637.37379116 267.35689643]
[ 0. 0. 1. ]]
Left Distortion Coefficients
[[ 0.07129149 -0.32551738 0.00165004 0.00582742 0.55830776]]
Right Camera Matrix
[[628.54997755 0. 278.88536288]
[ 0. 638.88299319 262.29519192]
[ 0. 0. 1. ]]
Right Distortion Coefficients
[[ 0.05281363 -0.20836547 0.0015596 0.00694854 -0.18818856]]
Calibrating cameras together...
Rotation Matrix
[[ 9.78166692e-01 -2.92706245e-02 -2.05750220e-01]
[ 2.87961989e-02 9.99571250e-01 -5.30056367e-03]
[ 2.05817156e-01 -7.39989429e-04 9.78590185e-01]]
Translation Vector
[[6.87024126]
[0.33698621]
[0.82946341]]
如果我可以从两个相机中检测到一个物体,让我们说在左相机的像素 (a, b) 和右相机的 (c, d) 中找到一个物体。有什么方法可以让我获得一台相机与物体之间的距离?
另外,我的脚本实现了 cv2.stereoRectify 和 cv2.initUndistortRectifyingMap,它们可用于获取固定帧,然后使用 cv2.StereoBM_create() 计算深度图。好吧,老实说,我不确定这是否可以用来计算距离。
谢谢!