Code Monkey home page Code Monkey logo

Comments (5)

pmoulon avatar pmoulon commented on June 6, 2024

Hi,

Considering the translation does not affect the results.
But I will consider your remark. Thanks.

Regards

from openmvg.

cdcseacave avatar cdcseacave commented on June 6, 2024

the full formula for converting a point from image to world coordinates is:
x = (u_depth, v_depth, depth)
X = R.t() * K.inv() * x + C
getting the ray:
ray = X - C
and thus C is not needed, neither the depth which will be removed during normalization

the problem in your code is that you forget to add C so that substracting it at the end is therefore incorrect

from openmvg.

pmoulon avatar pmoulon commented on June 6, 2024

So you suggest using only the following:
Vec3 ray1 = cam1._R.transpose() * (cam1._K.inverse() * Vec3(x1(0),x1(1),1.)).normalized();
Vec3 ray2 = cam2._R.transpose() * (cam2._K.inverse() * Vec3(x2(0),x2(1),1.)).normalized();
ray1.normalize();
ray2.normalize();
double mag = ray1.norm() * ray2.norm();
double dotAngle = ray1.dot(ray2);
return R2D(acos(clamp(dotAngle/mag, -1.0+1.e-8, 1.0-1.e-8)));

from openmvg.

cdcseacave avatar cdcseacave commented on June 6, 2024

something like that, but simpler:
Vec3 ray1 = (cam1._R.transpose() * (cam1._K.inverse() * Vec3(x1(0),x1(1),1.))).normalized();
Vec3 ray2 = (cam2._R.transpose() * (cam2._K.inverse() * Vec3(x2(0),x2(1),1.))).normalized();
double dotAngle = ray1.dot(ray2);
return R2D(acos(clamp(dotAngle, -1.0+1.e-8, 1.0-1.e-8)));

from openmvg.

pmoulon avatar pmoulon commented on June 6, 2024

Thanks to cdcseacave it's now fixed in the develop branch.

from openmvg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.