gaoxiang12 / slambook-en

The English version of 14 lectures on visual SLAM.
GNU General Public License v3.0
1.41k stars 255 forks source link

Chapter 7, 7.4 Practice: Different Results from book, pose_estimation_2d2d.cpp #31

Open nicolasrosa opened 3 years ago

nicolasrosa commented 3 years ago

Hello @gaoxiang12,

I just finishing Practice 7.4, I noticed some slight differences between the results from the slambook2/ch7/pose_estimation_2d2d.cpp code and the results presented in the book.

The first one, the max_dist variable, when running on my computer, your code returns 94.0, in the book your results were 95.0. The second one, the following matrices results are also quite different from the ones presented in the book.

F:
[4.544437503937326e-06, 0.0001333855576988952, -0.01798499246457619;
 -0.0001275657012959839, 2.266794804637672e-05, -0.01416678429258694;
 0.01814994639952877, 0.004146055871509035, 1]
(3, 3)

E:
[0.01097677480088526, 0.2483720528258777, 0.03167429207291153;
 -0.2088833206039177, 0.02908423961781584, -0.6744658838357441;
 0.008286777636447118, 0.6614041624098427, 0.01676523772725936]
(3, 3)

H:
[0.9261214281395974, -0.1445322024422794, 33.26921085290527;
 0.04535424466077623, 0.9386696693994374, 8.57097996306166;
 -1.006197557592423e-05, -3.008140277952937e-05, 0.9999999999999999]
(3, 3)

R:
[0.9969387384754708, -0.05155574188737422, 0.05878058527591362;
 0.05000441581290405, 0.998368531736214, 0.02756507279306544;
 -0.06010582439453527, -0.02454140006844052, 0.9978902793175882]
(3, 3)

t:
[-0.9350802885437915;
 -0.03514646275858852;
 0.3526890700495534]
(3, 1)

In some cases, the differences are very small, but is this the case with the t translation vector? I imagined that the results would be different when running on different computers, I didn't imagine that much.

gaoxiang12 commented 3 years ago

@nicolasrosa For the number of features, I think it depends on the OpenCV version. Both 94 and 95 are ok for this experiment. For the translation vector, I must say the quality of essential matrix decomposition is somehow unstable. The translation vector is sensitive to the extracted features (and their pixel position). Since only the direction of t matters, we may draw the results in a sphere: Vectors

You can also adjust the number of the detected features and see how the translation vector changes.