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 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.

1 Answer

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)

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest