1、相机镜头表面距离桌面1m,输入的图像没有内参文件,内参和畸变采用freenect包默认参数,棋盘格19×14,每一个4厘米,实际坐标为,左上角(0,0)点,水平向右为x正方向,垂直向下为y轴负方向
2、四个角点分别为
pixel_point= np.array([
[155.08159, 57.66385],
[505.4953, 55.266895],
[522.11066, 313.81503],
[135.968, 311.828]
])
world_point= np.array([
[0.0, 0.0, 0.0],
[720.0, 0.0, 0.0],
[720.0, -520.0, 0.0],
[0.0, -520.0, 0.0]
])
4、验证结果,实际坐标
[[ -4.05488531 719.76483854 720.5608823 -4.77362602]
[ 8.235876 5.34935788 -521.29230982 -523.03245145]
[ 1. 1. 1. 1. ]]
5、一些参数
(1)内参
[[561.19068618 0. 315.72071183]
[ 0. 558.64303535 240.36261192]
[ 0. 0. 1. ]]
(2)畸变
[ 0.06844978 -0.05714101 -0.00097167 -0.00637341 0. ]
(4)r1[0]
(array([[ 0.99921849, 0.01026611, -0.03817089],
[ 0.00246621, -0.97999406, -0.19901145],
[-0.03945032, 0.19876179, -0.9792535 ]])
(5) t
[[-332.09409591]
[-375.87254215]
[1172.22871055]]
(6) R1R2
[[ 9.99218489e-01 1.02661114e-02 -3.32094096e+02]
[ 2.46621039e-03 -9.79994061e-01 -3.75872542e+02]
[-3.94503238e-02 1.98761786e-01 1.17222871e+03]]
(3)还原的相机坐标
print(np.dot(np.linalg.inv(K),pixel_yanzheng))
[[-0.28624695 0.33816418 0.36777151 -0.32030594]
[-0.32704026 -0.33133093 0.13148364 0.12792675]
[ 1. 1. 1. 1. ]]
继续乘外参数的逆矩阵
a=np.dot(np.linalg.inv(K),pixel_yanzheng)
pixel_to_world=np.dot(np.linalg.inv(R1R2T),a)
结果
[[ -4.05488531 719.76483854 720.5608823 -4.77362602]
[ 8.235876 5.34935788 -521.29230982 -523.03245145]
[ 1. 1. 1. 1. ]]
求得的四个点的深度值
print(1.0/pixel_to_world[2])
[1174.02565451 1144.8970025 1040.18936002 1068.45816761]