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

camera.img_from_cam not working #253

Closed
iMeleon opened this issue Jan 25, 2024 · 1 comment · Fixed by #256
Closed

camera.img_from_cam not working #253

iMeleon opened this issue Jan 25, 2024 · 1 comment · Fixed by #256
Labels
enhancement New feature or request

Comments

@iMeleon
Copy link

iMeleon commented Jan 25, 2024

uv = camera.img_from_cam(image.cam_from_world * point3D.xyz) example from docs is not working

why function img_from_cam accept 2d point? maybe it should accept 3d point? image.cam_from_world * point3D.xyz produces 3d point in camera space, yes?

camera.img_from_cam(np.array([1,2,3]))

TypeError: img_from_cam(): incompatible function arguments. The following argument types are supported:
    1. (self: pycolmap.Camera, arg0: numpy.ndarray[numpy.float64[2, 1]]) -> numpy.ndarray[numpy.float64[2, 1]]
    2. (self: pycolmap.Camera, arg0: numpy.ndarray[numpy.float64[m, 2]]) -> numpy.ndarray[numpy.float64[m, 2]]
    3. (self: pycolmap.Camera, arg0: List[colmap::Point2D]) -> numpy.ndarray[numpy.float64[m, 2]]
@sarlinpe
Copy link
Collaborator

The documentation is incorrect, it should be:

p = image.cam_from_world * point3D.xyz
uv = camera.img_from_cam(p[:2] / p[-1])

We should overload img_from_cam to accept a 3D vector as well.

@sarlinpe sarlinpe added the enhancement New feature or request label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants