Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot extract cornor #8

Open
vzhr opened this issue Sep 29, 2022 · 2 comments
Open

Cannot extract cornor #8

vzhr opened this issue Sep 29, 2022 · 2 comments

Comments

@vzhr
Copy link

vzhr commented Sep 29, 2022

using apriltag only in debug mode or I set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") in CMakeLists.txt,can extract cornor. If i remove "-march=native", this does not work.

gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
cmake version 3.16.3
5.4.0-126-generic #142-Ubuntu
Ubuntu 20.04
OpenCV 4
@vzhr
Copy link
Author

vzhr commented Sep 30, 2022

After some tests, I find the problem. The exact problems are

add_compile_options("-funsafe-math-optimizations" "-fno-signed-zeros")

added in CMakeLists.txt. What causes this problem?

@vzhr
Copy link
Author

vzhr commented Sep 30, 2022

OK, I got it! in file GrayModel.cc, function: compute(),
change

bool invertible;
double det_unused;
A.computeInverseAndDetWithCheck(Ainv, det_unused, invertible);
   if (invertible) {
     v = Ainv * b;
     return;
   }

to:

bool invertible;
A.computeInverseWithCheck(Ainv, invertible);
    if (invertible) {
     v = A.ldlt().solve(b)
      return;
    }

A inverse is not stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant