1. The surface of the camera lens is 1m away from the desktop. The input image does not have an internal reference file. The internal reference and distortion adopt the default parameters of the freenect package. The checkerboard is 19×14, each 4 cm. The actual coordinates are (0,0) point in the upper left corner, horizontal To the right is the positive direction of x, and vertically downward is the negative direction of the y-axis
2. The four corner points are respectively
pixel_point= np.array([
[155.08159, 57.66385],
[505.4953, 55.266895],
[522.11066, 313.81503],
[135.968, 311.828]
])
The starting point is the upper left corner, clockwise.
3. Actual corresponding coordinates
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. Verification results, actual coordinates
[[ -4.05488531 719.76483854 720.5608823 -4.77362602]
[ 8.235876 5.34935788 -521.29230982 -523.03245145]
[ 1. 1. 1. 1. ]]
5. Some parameters
(1) internal reference
[[561.19068618 0. 315.72071183]
[ 0. 558.64303535 240.36261192]
[ 0. 0. 1. ]]
(2) Distortion
[ 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) Restored camera coordinates
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. ]]
Continue to multiply the inverse matrix of the external parameters
a=np.dot(np.linalg.inv(K),pixel_yanzheng)
pixel_to_world=np.dot(np.linalg.inv(R1R2T),a)
result
[[ -4.05488531 719.76483854 720.5608823 -4.77362602]
[ 8.235876 5.34935788 -521.29230982 -523.03245145]
[ 1. 1. 1. 1. ]]
The obtained depth values of the four points
print(1.0/pixel_to_world[2])
[1174.02565451 1144.8970025 1040.18936002 1068.45816761]