MVOScaleRecovery icon indicating copy to clipboard operation
MVOScaleRecovery copied to clipboard

[Question] How to run correctly with cv2.recoverPose in thirdparty/visual_odometry.py

Open JEFFCHANG0501 opened this issue 3 years ago • 2 comments

Hello, it's an excellent work. But I face a problem when I run visual_odometry.py. It seems that there is a problem with cv2.revocerPose function.

image

According to opencv document opencv, the code seems reasonable for using recoverPose. So, I try to use this function without output 'triangulatedPoints' to get Rotation and translation, and it worked. I am confused why it doesn't work with output 'triangulatedPoints'.

_, self.cur_R, self.cur_t, mask,points_3d = cv2.recoverPose(E, self.px_cur,\ self.px_ref,cameraMatrix=self.camera_matrix,distanceThresh=100)

JEFFCHANG0501 avatar Mar 07 '22 02:03 JEFFCHANG0501

@JEFFCHANG0501 Hi, thanks, and sorry for the late reply.
The reason for your problem may be the difference in the OpenCV version. I tried OpenCV '4.5.5', where the following code worked

_, self.cur_R, self.cur_t, mask,points_3d = cv2.recoverPose(E, self.px_cur,\ self.px_ref,cameraMatrix=self.camera_matrix,distanceThresh=100)

TimingSpace avatar Mar 11 '22 16:03 TimingSpace

@TimingSpace Thanks for the reply. I will try the OpenCV version you provided.

JEFFCHANG0501 avatar Mar 14 '22 08:03 JEFFCHANG0501