Skip to content

Add tests for MVS model#4177

Merged
ahojnnes merged 4 commits into
mainfrom
user/jsch/mvs-model-cov-test
Mar 4, 2026
Merged

Add tests for MVS model#4177
ahojnnes merged 4 commits into
mainfrom
user/jsch/mvs-model-cov-test

Conversation

@ahojnnes

@ahojnnes ahojnnes commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness of the MVS module by adding a comprehensive suite of unit tests for the Model class. These tests ensure the correct behavior of various core functionalities, from data loading to geometric computations. Additionally, it includes minor refactorings to improve code efficiency and adherence to modern C++ practices, specifically by optimizing string returns and using constexpr for compile-time constants.

Highlights

  • New Test Suite: Introduced a new test suite (model_test.cc) to thoroughly validate the MVS Model class functionalities, covering aspects like COLMAP data reading, shared points computation, depth range calculation, triangulation angles, and overlapping images.
  • Performance Refactoring: Refactored the GetImageName method in model.h and model.cc to return a const std::string&, enhancing performance by avoiding unnecessary string copies.
  • Code Modernization: Updated constant declarations within model.cc to use constexpr, enabling compile-time evaluation for improved efficiency and adherence to modern C++ practices.
Changelog
  • src/colmap/mvs/CMakeLists.txt
    • Added model_test to the build system.
  • src/colmap/mvs/model.cc
    • Modified GetImageName method to return a constant reference to a string, improving efficiency.
    • Updated constant declarations in ComputeDepthRanges to use constexpr.
  • src/colmap/mvs/model.h
    • Updated GetImageName declaration to return a constant reference.
  • src/colmap/mvs/model_test.cc
    • Added ReadCOLMAP test to verify model loading from COLMAP format.
    • Included ComputeSharedPoints test to check shared point calculation.
    • Implemented ComputeDepthRanges test for depth range computation with points.
    • Added ComputeDepthRangesNoPoints test for depth range computation without points.
    • Created ComputeTriangulationAngles test to validate triangulation angle calculations.
    • Introduced GetMaxOverlappingImages test for determining maximally overlapping images.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds a test suite for the mvs::Model class and refactors GetImageName to return a const reference, avoiding a string copy. The new tests cover several functions within the mvs::Model class. My review includes suggestions to improve the conciseness of the test code by using modern C++ initialization patterns for creating test data. No comments were dropped or modified based on the provided rules, as they did not apply to the content of the comments.

Comment thread src/colmap/mvs/model_test.cc Outdated
Comment thread src/colmap/mvs/model_test.cc Outdated
Comment thread src/colmap/mvs/model_test.cc Outdated
Comment thread src/colmap/mvs/model_test.cc Outdated
Comment thread src/colmap/mvs/model_test.cc Outdated
Comment thread src/colmap/mvs/model_test.cc Outdated
Comment thread src/colmap/mvs/model_test.cc Outdated
Comment thread src/colmap/mvs/model_test.cc
…ometry

- Replace EXPECT_GT with EXPECT_NEAR using 2*atan(0.5/10) as expected value
- Fix translation vectors so projection centers match intended positions
  (projection center = -R^T * T, so T must be negated for R=I)
- Add clarifying comments about projection center computation
@ahojnnes ahojnnes enabled auto-merge (squash) March 4, 2026 10:02
@ahojnnes ahojnnes merged commit 27fc292 into main Mar 4, 2026
14 checks passed
@ahojnnes ahojnnes deleted the user/jsch/mvs-model-cov-test branch March 4, 2026 11:15
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.

2 participants