Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rodrigues function in Python version opencv not working

I want to use python version opencv function Rodrigues() to convert rotation matrix to the rotation vector. The rotMat to be converted is

 [[ 0.59966056 -0.59966056  0.52991926]
 [ 0.70710678  0.70710678  0.        ]
 [-0.37470951  0.37470951  0.8480481 ]]

and the code I wrote is something like

rotVec = np.zeros((1, 3), np.float32)
cv2.Rodrigues(rotMat, rotVec)

Which follows the documentation like enter image description here But it turns out that the result is all 0 and the function is not working. I am very new to python and I am appreciated if someone could point out error.

like image 815
SimaGuanxing Avatar asked Mar 15 '26 07:03

SimaGuanxing


1 Answers

Your function call isn't quite correct; you do need to handle both return arguments, even if you ignore one. These calls should work for you: rotVec,_ = cv2.Rodrigues(rotMat) or cv2.Rodrigues2(rotMat,rotVec, jacb)

like image 96
Thesane Avatar answered Mar 16 '26 19:03

Thesane