findEssentialMat or decomposeEssentialMat do not work correctly
I ganerated 3d points, projected them to 2 cameras (dst and src) with known positions and tryed to recover camera positions.
dst camera have no rotarions and translations, so one of rotations returned by decomposeEssentialMat should be src rotarion.
However rotations and translation returned by decomposeEssentialMat both absolutely incorrect
import cv2 import numpy as np objectPoints = np.float64([[-1,-1,5],[1,-1,5],[1,1,5],[-1,1,5],[0,0,0],[0,0,5]]) srcRot = np.float64([[0,0,1]]) srcT = np.float64([[0.5,0.5,-1]]) dstRot = np.float64([[0,0,0]]) dstT = np.float64([[0,0,0]]) cameraMatrix = np.float64([[1,0,0], [0,1,0], [0,0,1]]) srcPoints = cv2.projectPoints(objectPoints,srcRot,srcT,cameraMatrix,None)[0] dstPoints = cv2.projectPoints(objectPoints,dstRot,dstT,cameraMatrix,None)[0] E = cv2.findEssentialMat(srcPoints,dstPoints)[0] R1,R2,t = cv2.decomposeEssentialMat(E) print cv2.Rodrigues(R1)[0] print cv2.Rodrigues(R2)[0] print t
the resut for R and t
R1=[[-2.8672671 ] [ 0.82984579] [ 0.12698814]] R2=[[ 0.84605365] [ 2.92326821] [-0.24527328]] t=[[ 8.47069335e-04] [ -3.75356183e-03] [ -9.99992597e-01]]
The rotation are correct just in case of the same height of cameras positions, but direction is always wrong. Is it bug or my mistake?
I have the same problem anyone knows if it is a bug? I use th C++ code.