felixchenfy / Monocular-Visual-Odometry

A simple monocular visual odometry (part of vSLAM) by ORB keypoints with initialization, tracking, local map and bundle adjustment. (WARNING: Hi, I'm sorry that this project is tuned for course demo, not for real world applications !!!)
MIT License
398 stars 91 forks source link

fix T=ref.pose * T_curr_to_prev #16

Closed bongbui321 closed 12 months ago

bongbui321 commented 1 year ago

In the estimateMotionAnd3D(), based on your original code T = ref_T_wc * (Translation matrix) However it resulted in wrong odometry. I changed it to multiply with the Translation matrix only, which makes it correct. Do you mind checking why it is like that. I think your logic is correct since to get the coordinate translation of camera 1 to camera 2 we would need to take the inverse, but that result in incorrect odometry for the example you provided.

bongbui321 commented 12 months ago

Your logic/code is correct as we need to get the inverse of the translation matrix derived from the essential matrix. I have tested with opencv 4.8 and it gave the seemingly correct pose using the logic in your code. However, for opencv 4.0.0 taking out the inverse give us a more correct pose estimation. I'm not sure why, so I assume the code for opencv 4.0.0 is incorrect