1
$\begingroup$

I am having trouble recovering rotation and translation from an essential matrix. I am constructing this matrix using the following equation: \begin{equation} E = R \left[t\right]_x \end{equation}

which is the equation listed on Wikipedia. With my calculated Essential matrix I am able to show the following relation holds: \begin{equation} \left( \hat x \right) E x = 0 \end{equation}

for the forty or so points I am randomly generating and projecting into coordinate frames. I decompose $E$ using SVD then compute the 2 possible translations and the two possible rotations. These solutions differ significantly from the components I'm starting with.

I have pasted a simplified version of the problem I am struggling with below. Is there anything wrong with how I am recovering the these components?

import numpy as np


t = np.array([-0.08519122, -0.34015967, -0.93650086])

R = np.array([[ 0.5499506 , 0.28125727, -0.78641508],
    [-0.6855271 , 0.68986729, -0.23267083],
    [ 0.47708168, 0.66706632, 0.57220241]])

def cross(t):
    return np.array([
    [0, -t[2], t[1]],
    [t[2], 0, -t[0]],
    [-t[1], t[0], 0]])


E = R.dot(cross(t))


u, _, vh = np.linalg.svd(E, full_matrices=True)

W = np.array([
[ 0,-1, 0],
[ 1, 0, 0],
[ 0, 0, 1]])

Rs = [u.dot(W.dot(vh.T)), u.dot(W.T.dot(vh.T))]
Ts = [u[:,2], -u[:,2]]
$\endgroup$
4
  • 1
    $\begingroup$ Welcome to COMPUTERSCIENCE @SE. Can you try and present your procedure as pseudo code (close as NumPy code already is)? $\endgroup$
    – greybeard
    Aug 1 '20 at 6:07
  • $\begingroup$ There current numpy code fully captures my problem. R and t are valid and the construction of E is correct. I would like to recover R and normalized t from E. The equations I'm using to generate the hypothesis are found in wikipedia as well as numerous lecture slides found across the internet. While my actual procedure does involve randomly generating points and checking E, I think this would complicate the question. Also, the numpy code should run which I'm hoping will help something answer this question $\endgroup$
    – holmeski
    Aug 1 '20 at 10:38
  • $\begingroup$ @greybeard, is this question not suitable for cs se? $\endgroup$
    – holmeski
    Aug 12 '20 at 16:54
  • $\begingroup$ (Not having a firm grasp of whether this is a pure math problem,) I think this question fits nicely. It is just that pseudo code is considered to be more appropriate than any concrete programming language. $\endgroup$
    – greybeard
    Aug 12 '20 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.