mergarsal / GNCSO

Header-based library for robust GNC+BR
GNU General Public License v3.0
16 stars 1 forks source link

Essential matrix estimation returning zeros #2

Closed OsamaAlAhmadieh closed 1 year ago

OsamaAlAhmadieh commented 1 year ago

hello,

thank you for making your code available!

I cloned the repo and followed the steps. When I run the example for rotation ./GNC_rotation_example I get results. But if I run the example for the essential matrix ./GNC_essential_example I get all the estimated essential matrices as zero.

I am running ubuntu 22.04, gcc 11.3.0, eigen 3.4.0.

Output:

Naive Test Essential Matrix
Solving problem without outliers nor noise...
[GM] Initializing mu...
Result without outliers
------------
Ground truth essential matrix:
-0.516086  0.142204  0.565657
 0.409285  0.186699  0.789492
-0.752355 0.0171085 0.0383034
Estimated essential matrix:
0 0 0
0 0 0
0 0 0
Number of detected inliers: 100
Solving problem with noise...
[GM] Initializing mu...
Result with noise 0.03
------------
Ground truth essential matrix:
-0.516086  0.142204  0.565657
 0.409285  0.186699  0.789492
-0.752355 0.0171085 0.0383034
Estimated essential matrix:
0 0 0
0 0 0
0 0 0
Number of detected inliers: 100
Solving problem with outliers (GM)...
[GM] Initializing mu...
-----------GNC + GM --------------
Result with 30 outliers
------------
Ground truth essential matrix:
-0.516086  0.142204  0.565657
 0.409285  0.186699  0.789492
-0.752355 0.0171085 0.0383034
Estimated essential matrix:
0 0 0
0 0 0
0 0 0
Number of detected inliers: 100 

Also one remark: In the file example/GNC_essential_examples line 216, 246, and 271, we want to get the number of inliers. Currently we are printing the size() of the set_inliers, but shouldn't we be printing the sum()?.

Thank you!

mergarsal commented 1 year ago

Hello,

Thanks for the comment. Unfortunately, I cannot reproduce the error. The only thing I can think of is that no inliers are detected at the end. The inliers depend on the final weights (you can read them with results_outliers.weights ) and the inlier threshold (an input parameter called inliers_threshold, line 194 in GNC_essential_example).

Also, you are correct about the .size() function. It should be .sum() to compute the number of inliers. I will update the example file when the issue is resolved

OsamaAlAhmadieh commented 1 year ago

Hello @mergarsal , thank you for responding! for reproducing, did you try cloning the repo from scratch and building? I have tried it in several docker containers, and on my system directly. If I'm following the steps directly and building, for some reason the essential matrix script is not matching the call to the functions defined in the header files although the rotation script is running smoothly. I printed the results.weights at the end, and they were still all 1. I also set the param GNC_verbose to true, but nothing was printed. This indicates that we are simply not calling the GNC functions. It might be a CMake issue. As for the .sum() thank you for checking it! If you haven't tried starting from scratch, it would be great if you could check that! Thank you again for the activity!

mergarsal commented 1 year ago

Hello. I manage to reproduce the error. The problem was the return of the fcn VariableEstimation. The new commit (c605b5b) works for Ubuntu 22.04, gcc 11.3.0 and eigen 3.4.0, let me know if it fixes the problem on your setup

OsamaAlAhmadieh commented 1 year ago

Hello, the fix in the commit works, thank you for taking care of this!