Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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 think 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

4 participants