8000 Fix binding for std::vector<Point2D> by sarlinpe · Pull Request #2533 · colmap/colmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix binding for std::vector<Point2D> #2533

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

Merged
merged 5 commits into from
Apr 22, 2024
Merged

Conversation

sarlinpe
Copy link
Member

The fix introduced in colmap/pycolmap#95 actually disables the binding of std::vector<Point2D>, which defaults to a regular Python list and is much slower, as reported in #2530. To fix this, I had to 1) remove the Eigen aligned operator, and 2) apply the opaque macro to camera.cc and image.cc.

Run time of image.points2D[index]:

  • main branch: 1ms
  • this PR: 7us
  • using image.point2D(index): 4us (introduced in this PR as shortcut)

Fixes #2530.

@B1ueber2y
Copy link
Contributor
B1ueber2y commented Apr 22, 2024

Looks nice. Thanks. Any idea why point2D(index) is faster? Should we introduce this to all similar interfaces?

@sarlinpe
Copy link
Member Author

Building the opaque object wrapping std::vector and calling __getitem__ for have some overheads. Since you already added Reconstruction::{Camera,Image,Point3D} I th 8000 ink that there's nowhere else to apply this.

@sarlinpe sarlinpe requested a review from ahojnnes April 22, 2024 18:11
@sarlinpe sarlinpe enabled auto-merge (squash) April 22, 2024 18:12
@sarlinpe sarlinpe merged commit 8793fae into main Apr 22, 2024
@sarlinpe sarlinpe deleted the sarlinpe/fix-point2d-vector branch April 22, 2024 19:36
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.

The opaque type binding of ListPoint2D is not working
3 participants
0