Skip to content

Conversation

servantftransperfect
Copy link
Contributor

@servantftransperfect servantftransperfect commented Sep 29, 2025

This is a first bootstrapping solution for depthmaps. It is very basic at the moment and should be improved over time !

This pull request introduces a new "depth" bootstrapping method to the Structure-from-Motion (SfM) pipeline, alongside the existing "classic" and "mesh" methods. It adds the necessary infrastructure to handle depth-based bootstrapping, including new C++ logic, Python interface updates, and supporting utilities for constructing SfM data from depth maps. The changes are grouped below by theme.

New bootstrapping method: "depth"

  • Added a new parameter method (choices: "classic", "mesh", "depth") to the SfMBootStrapping node in the Python interface, allowing users to select the bootstrapping approach. The mesh file parameter is now only enabled if the "mesh" method is selected. [1] [2]
  • Introduced an enum EBOOTSTRAPMETHOD and a string-to-enum conversion utility to handle the new method in the C++ pipeline entry point.

Depth-based bootstrapping implementation

  • Added the bootstrapDepth function, which constructs initial camera poses and landmarks using depth information from tracks, and integrates it into the bootstrapping pipeline. [1] [2]
  • Implemented buildSfmDataFromDepthMap in new files TracksDepths.cpp and TracksDepths.hpp, providing utilities to build minimal SfMData objects from depth maps for a given view. [1] [2]
  • Updated CMake and includes to register and use the new depth-based files and logic. [1] [2] [3] [4]

Pair selection using depth information

  • Added findBestPairFromTrackDepths to select the best initial image pair using depth information, with supporting documentation and logic. [1] [2]

Supporting API improvements

  • Added a const overload for getViewSharedPtr in SfMData to facilitate safe access during depth-based operations.

@servantftransperfect servantftransperfect added this to the 3.4.0 milestone Sep 29, 2025
@servantftransperfect servantftransperfect changed the title Bootstrap with prior depth Bootstrap with injected depths from Depthmaps Sep 29, 2025
Copilot

This comment was marked as outdated.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

requiredParams.add_options()
("input,i", po::value<std::string>(&sfmDataFilename)->required(), "SfMData file.")
("output,o", po::value<std::string>(&sfmDataOutputFilename)->required(), "SfMData output file.")
("method", po::value<std::string>(&methodString)->required(), "Method choice.")
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

[nitpick] The parameter description 'Method choice.' is too vague. Consider providing more descriptive text like 'Bootstrapping method: classic (epipolar geometry), mesh (3D mesh constraints), or depth (depth map information)'.

Suggested change
("method", po::value<std::string>(&methodString)->required(), "Method choice.")
("method", po::value<std::string>(&methodString)->required(), "Bootstrapping method: classic (epipolar geometry), mesh (3D mesh constraints), or depth (depth map information).")

Copilot uses AI. Check for mistakes.


if (!firstViewFilters.empty())
{
ALICEVISION_LOG_ERROR("No known pose for mesh");
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

The error message 'No known pose for mesh' is unclear. It should explain that mesh bootstrapping requires empty view filters or provide guidance on the expected configuration.

Suggested change
ALICEVISION_LOG_ERROR("No known pose for mesh");
ALICEVISION_LOG_ERROR("Mesh bootstrapping requires empty view filters. Please ensure that no view filters are set when using mesh bootstrapping.");

Copilot uses AI. Check for mistakes.


sfm::SfmResection resection;
resection.setMaxIterations(1024);
resection.setResectionMaxError(std::numeric_limits<double>::infinity());
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

Setting resection max error to infinity removes error constraints entirely. Consider using a reasonable upper bound or making this configurable to maintain stability and prevent degenerate solutions.

Suggested change
resection.setResectionMaxError(std::numeric_limits<double>::infinity());
// Use a reasonable finite reprojection error threshold (in pixels) instead of infinity.
// Consider making this value configurable if needed.
resection.setResectionMaxError(4.0);

Copilot uses AI. Check for mistakes.

Comment on lines +206 to +207
resection.setMaxIterations(50000);
resection.setResectionMaxError(std::numeric_limits<double>::infinity());
Copy link

Copilot AI Oct 13, 2025

Choose a reason for hiding this comment

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

Using infinity for max error and 50000 iterations are magic numbers that should be defined as named constants or made configurable parameters for better maintainability.

Copilot uses AI. Check for mistakes.

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.

1 participant