8000 Colmap utility functions and editing colmap functions for MP-SfM by Zador-Pataki · Pull Request #3331 · colmap/colmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Colmap utility functions and editing colmap functions for MP-SfM #3331

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Zador-Pataki
Copy link

Splitting my last PR into 2 Part 1.

These functions are needed for MP-SfM. They are also generic extensions of COLMAP that could be used elsewhere.

See original PR #3269

Copy link
Contributor
@ahojnnes ahojnnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me for the most part. Left a few small comments.

@@ -343,18 +343,19 @@ size_t ObservationManager::FilterObservationsWithNegativeDepth() {
size_t ObservationManager::FilterPoints3DWithSmallTriangulationAngle(
const double min_tri_angle,
const std::unordered_set<point3D_t>& point3D_ids) {
const std::unordered_set<point3D_t> to_remove = FindPoints3DWithSmallTriangulationAngle(min_tri_angle, point3D_ids);
const std::vector<point3D_t> ids_vec(point3D_ids.begin(), point3D_ids.end());
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahojnnes updated FindPoints3DWithSmallTriangulationAngle inputs/outputs following #3331 (comment). However, I did not convert the FilterPoints3DWithSmallTriangulationAngle input to std::unordered_set<point3D_t>.

As a result, I need to convert ids from set to vec. Changing the input to vec as well would also mean changing the inputs to this function in the COLMAP pipeline

"options"_a,
"image_id"_a,
"reconstruction"_a);
&IncrementalMapper::ClearModifiedPoints3D)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahojnnes done following #3331 (comment)

Note that find_local_bundle is taken (uses the reconstruction object in self), hence the new name. I need to find a local bundle for an input reconstruction. I've made it static because I don't use IncrementalMapper in MP-SfM. This why I can do pycolmap.IncrementalMapper.find_rec_local_bundle(options, refimid, self.rec).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe find_local_bundle_from_reconstruction? Your current naming does not give intuitive meaning.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I guess I didn't look close enough in that this takes a custom 3D reconstruction and not the one managed by the mapper? Sorry for the confusion, but in this case a free-standing function could indeed be more suitable.

@@ -139,6 +139,9 @@ class Reconstruction {
// Delete all 2D points of all images and all 3D points.
void DeleteAllPoints2DAndPoints3D();

// Return the 3D coordinates of the given point IDs.
Eigen::MatrixXd Point3DCoords(const std::vector<point3D_t>& point3D_ids) const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reconstruction.Point3DCoords and image.Point2DCoords should ideally have identical interfaces.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahojnnes @B1ueber2y I agree, however, I don't think there is an elegant solution for this one. The biggest differences is that image.Point2DCoords returns all point2D coordinates, while reconstruction.Point3DCoords takes list of 3D points. Since COLMAP filters 3D points, not all ids between 1 and the maximum point3D id has a 3D point. Thus, if we omit the input ids, we either

  1. return as many coordinates as there are 3D points, such that they each correspond to a sorted list of ids, or
  2. we return as many coordinates as the max point3D id, with some filler value where there is a missing 3D point. This way, in python, we could access the point using a 1D array of point3D ids (like for image.Point2DCoords)

}

void BindIncrementalMapper(py::module& m) {
BindIncrementalMapperImpl(m);
BindIncrementalPipeline(m);

m.def("find_local_bundle_from_reconstruction",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahojnnes following your suggestion #3331 (comment), I have made this into a free-standing function. What do you think of this placement?

@Zador-Pataki
Copy link
Author

Seems like only #3331 (comment), #3331 (comment) and #3331 (comment) remain

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
0