def test_essential_matrix_residuals(): tform = EssentialMatrixTransform(rotation=np.eye(3), translation=np.array([1, 0, 0])) src = np.array([[0, 0], [0, 0], [0, 0]]) dst = np.array([[2, 0], [2, 1], [2, 2]]) assert_almost_equal(tform.residuals(src, dst)**2, [0, 0.5, 2])
def test_essential_matrix_inverse(): tform = EssentialMatrixTransform(rotation=np.eye(3), translation=np.array([1, 0, 0])) src = np.array([[0, 0], [0, 1], [1, 1]]) assert_almost_equal(tform.inverse(src), [[0, 1, 0], [0, 1, -1], [0, 1, -1]])
def test_essential_matrix_init(): tform = EssentialMatrixTransform(rotation=np.eye(3), translation=np.array([0, 0, 1])) assert_equal(tform.params, np.array([0, -1, 0, 1, 0, 0, 0, 0, 0]).reshape(3, 3))