Skip to content

Implicitly convert iterator to ListPoint2D#2558

Merged
sarlinpe merged 1 commit intomainfrom
sarlinpe/fix-empty-listpoint2d
May 8, 2024
Merged

Implicitly convert iterator to ListPoint2D#2558
sarlinpe merged 1 commit intomainfrom
sarlinpe/fix-empty-listpoint2d

Conversation

@sarlinpe
Copy link
Member

@sarlinpe sarlinpe commented May 7, 2024

Fix errors when pass an empty list as a vector<Point2D>:

    pycolmap.Image(points2D=[])
RuntimeError: instance allocation failed: new instance has no pybind11-registered base types
    camera.cam_from_img([])
TypeError: cam_from_img(): incompatible function arguments.

cc @B1ueber2y

@sarlinpe sarlinpe requested a review from ahojnnes May 7, 2024 21:34
@sarlinpe sarlinpe enabled auto-merge (squash) May 7, 2024 21:35
@B1ueber2y
Copy link
Contributor

I confirm that the fix works in my test. Thanks! However, do we need to put it in the scene/bindings.cc? It does not feel like the ideal place : )

@sarlinpe
Copy link
Member Author

sarlinpe commented May 8, 2024

It really needs to be there. Placing it in point2D.cc doesn't work. A working alternative is to place it in both image.cc and camera.cc , which duplicates code.

@sarlinpe sarlinpe merged commit d84c5b6 into main May 8, 2024
@sarlinpe sarlinpe deleted the sarlinpe/fix-empty-listpoint2d branch May 8, 2024 18:24
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

Successfully merging this pull request may close these issues.

3 participants