I have two calibrated cameras, I have their translation and rotation vector.
I tried to calculate the essential matrix from the parameters, and to reproduce the translation and rotation using cv2.decomposeEssentialMat() function, but the output translation and rotation is different from the translation and rotation I started with.
What I do wrong?
The initial translation and rotation:
T=[-1.15051923, -0.16560349, 0.],
R=
[[ 9.99840843e-01, -1.71024531e-02, 5.07888791e-03],
[ 1.71014523e-02, 9.99853731e-01, 2.40433213e-04],
[5.08225702e-03, -1.53538587e-04, 9.99987073e-01]]
The function I use for essential calculation:
def get_essential(translation, rotation):
tx = np.array([[0, -translation[2], translation[1]],
[translation[2], 0, -translation[0]],
[-translation[1], translation[0], 0]], dtype=np.float64)
e = np.dot(rotation, tx)
return e
and the output from cv2.decomposeEssentialMat(e) is:
R1 = array([[ 9.99840843e-01, -1.71024531e-02, 5.07888791e-03],
[ 1.71014523e-02, 9.99853731e-01, 2.40433213e-04],
[-5.08225702e-03, -1.53538587e-04, 9.99987073e-01]]),
R2 = array([[ 9.54428587e-01, 2.98396176e-01, -5.07888791e-03],
[ 2.98398850e-01, -9.54441234e-01, -2.40433213e-04],
[-4.91924439e-03, -1.28605798e-03, -9.99987073e-01]]),
T = array([[ 0.98720504],
[ 0.15937592],
[-0.00505229]])