can I multiply the equation and code it in such a manner as shown

38 Views Asked by At

For the following formula solving for world coordinates [X Y Z]:

$eq.(1)\begin{bmatrix} X \\ Y \\ Z \\ \end{bmatrix} = R^{T}\begin{bmatrix} u\\ v \\ 1 \\ \end{bmatrix} -R^{T}t $

Where R' is R$^{T}$, Wworld is $\begin{bmatrix} X\\ Y \\ Z \\ \end{bmatrix}$ Wcam is $\begin{bmatrix} u\\ v \\ 1 \\ \end{bmatrix}$ and tvec is a 3 x 1 mat called t, is it okay to code the minus as shown below?

$Wworld = R' Wcam -(R't) $

Wworld = R.transpose()* Wcam - (R.transpose() * tvec)

1

There are 1 best solutions below

3
On BEST ANSWER

Is this Python? If so, then you'll need to call the transpose function as np.transpose(R) rather than the way you have it written. To save operations, you may also want to factor out the $R^T$ and compute it as follows:

Wworld = np.transpose(R) * (Wcam - tvec).

I am assuming this whole time you have the line import numpy as np earlier in your code. Other than the way you're calling the transpose function, your way is correct too.