Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cattermole committed Jun 1, 2024
2 parents 82c2142 + ca124ab commit 0be5852
Show file tree
Hide file tree
Showing 16 changed files with 230 additions and 191 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ project(mayaMatchMoveSolver)
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 5)
set(PROJECT_VERSION_PATCH 0)
set(PROJECT_VERSION_TWEAK beta3)
set(PROJECT_VERSION_TWEAK beta4)
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}")
set(PROJECT_HOMEPAGE_URL "https://github.com/david-cattermole/mayaMatchMoveSolver")
set(PROJECT_DESCRIPTION "Bundle Adjustment solver for MatchMove tasks in Autodesk Maya.")
set(PROJECT_AUTHOR "David Cattermole and others (see AUTHORS.txt file)")
set(PROJECT_COPYRIGHT
"2018-2023, David Cattermole, Anil Reddy, Kazuma Tonegawa, Patcha Saheb Binginapalli.")
"2018-2024, David Cattermole, Anil Reddy, Kazuma Tonegawa, Patcha Saheb Binginapalli.")
enable_testing()


Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Copyright (C) 2018-2023 David Cattermole.
Copyright (C) 2018-2024 David Cattermole.
Copyright (C) 2019 Anil Reddy.
Copyright (C) 2020-2022 Kazuma Tonegawa.
Copyright (C) 2021-2022 Patcha Saheb Binginapalli.
Copyright (C) 2021-2023 Patcha Saheb Binginapalli.

This software, mmSolver, is licensed under the GNU LGPL v3 license.

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ changes.

| Releases | Description |
| --------------------------------------------------------------------------------------- | -------------------------------------------------- |
| [v0.4.8](https://github.com/david-cattermole/mayaMatchMoveSolver/releases/tag/v0.4.8) | Add Create Rivet and Surface Cluster tools. |
| [v0.4.7](https://github.com/david-cattermole/mayaMatchMoveSolver/releases/tag/v0.4.7) | Bug fix for "Convert to Marker" tool. |
| [v0.4.6](https://github.com/david-cattermole/mayaMatchMoveSolver/releases/tag/v0.4.6) | Bug fix for solver and minor features. |
| [v0.4.5](https://github.com/david-cattermole/mayaMatchMoveSolver/releases/tag/v0.4.5) | Introduction of MM Renderer and Maya 2024 support. |
Expand Down
24 changes: 12 additions & 12 deletions docs/source/download.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Download
========

Download the latest release **mmSolver v0.4.7**:
Download the latest release **mmSolver v0.4.9**:

.. list-table:: Downloads
:widths: auto
Expand All @@ -15,47 +15,47 @@ Download the latest release **mmSolver v0.4.7**:

* - Linux
- Maya 2019
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.7/mayaMatchMoveSolver-0.4.7-maya2019-linux.tar.gz>`_
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.9/mayaMatchMoveSolver-0.4.8-maya2019-linux.tar.gz>`_

* - Linux
- Maya 2020
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.7/mayaMatchMoveSolver-0.4.7-maya2020-linux.tar.gz>`_
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.9/mayaMatchMoveSolver-0.4.8-maya2020-linux.tar.gz>`_

* - Linux
- Maya 2022
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.7/mayaMatchMoveSolver-0.4.7-maya2022-linux.tar.gz>`_
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.9/mayaMatchMoveSolver-0.4.8-maya2022-linux.tar.gz>`_

* - Linux
- Maya 2023
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.7/mayaMatchMoveSolver-0.4.7-maya2023-linux.tar.gz>`_
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.9/mayaMatchMoveSolver-0.4.8-maya2023-linux.tar.gz>`_

* - Linux
- Maya 2024
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.7/mayaMatchMoveSolver-0.4.7-maya2024-linux.tar.gz>`_
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.9/mayaMatchMoveSolver-0.4.8-maya2024-linux.tar.gz>`_

* - Windows
- Maya 2018
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.7/mayaMatchMoveSolver-0.4.7-maya2018-win64.zip>`_
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.9/mayaMatchMoveSolver-0.4.8-maya2018-win64.zip>`_

* - Windows
- Maya 2019
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.7/mayaMatchMoveSolver-0.4.7-maya2019-win64.zip>`_
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.9/mayaMatchMoveSolver-0.4.8-maya2019-win64.zip>`_

* - Windows
- Maya 2020
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.7/mayaMatchMoveSolver-0.4.7-maya2020-win64.zip>`_
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.9/mayaMatchMoveSolver-0.4.8-maya2020-win64.zip>`_

* - Windows
- Maya 2022
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.7/mayaMatchMoveSolver-0.4.7-maya2022-win64.zip>`_
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.9/mayaMatchMoveSolver-0.4.8-maya2022-win64.zip>`_

* - Windows
- Maya 2023
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.7/mayaMatchMoveSolver-0.4.7-maya2023-win64.zip>`_
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.9/mayaMatchMoveSolver-0.4.8-maya2023-win64.zip>`_

* - Windows
- Maya 2024
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.7/mayaMatchMoveSolver-0.4.7-maya2024-win64.zip>`_
- `link <https://github.com/david-cattermole/mayaMatchMoveSolver/releases/download/v0.4.9/mayaMatchMoveSolver-0.4.8-maya2024-win64.zip>`_

Older versions and full release notes can be found on the GitHub releases_ page.

Expand Down
4 changes: 2 additions & 2 deletions external/openMVG/README.mayaMatchMoveSolver.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ This project was copied from the following lcoation:
Page: https://github.com/openMVG/openMVG
Documentation: https://openmvg.readthedocs.io/en/latest/
Git URL: https://github.com/openMVG/openMVG.git
Git Tag: v2.0
Git Commmit: d0fe73dd426ae4001631a51272cff71047522df9
Git Tag: v2.1
Git Commmit: 01193a245ee3c36458e650b1cf4402caad8983ef

## Copied Files

Expand Down
2 changes: 1 addition & 1 deletion external/openMVG/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ OpenMVG (open Multiple View Geometry)

| **License** | **Documentation** | Continuous Integration (Linux/MacOs/Windows) |Build | Code Quality | Chat |
|:-:|:-:|:-:|:-:|:-:|:-:|
| [![GitHub license](https://img.shields.io/badge/license-MPL2-blue)](https://github.com/openMVG/openMVG/blob/master/LICENSE) | [![doc](https://img.shields.io/badge/doc-readthedocs-blueviolet)](http://openmvg.readthedocs.org/en/latest) <br> [Wiki](https://github.com/openMVG/openMVG/wiki) | [![Build Status](https://travis-ci.org/openMVG/openMVG.png?branch=develop)](https://travis-ci.org/openMVG/openMVG) <br> [![Build status](https://ci.appveyor.com/api/projects/status/3nv6rt41yxqx5v7i?svg=true)](https://ci.appveyor.com/project/pmoulon/openmvg) | [local/docker build tutorial ](https://github.com/openMVG/openMVG/blob/master/BUILD.md)| [![Codacy Badge](https://api.codacy.com/project/badge/Grade/e067bc979aef48f5a96818714a5b33b9)](https://www.codacy.com/manual/pmoulon/openMVG?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=openMVG/openMVG&amp;utm_campaign=Badge_Grade) <br> [![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/openMVG/openMVG.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/openMVG/openMVG/context:cpp) <br> [![CodeFactor](https://www.codefactor.io/repository/github/openmvg/openmvg/badge)](https://www.codefactor.io/repository/github/openmvg/openmvg) | [![Join the chat](https://img.shields.io/badge/chat-on%20gitter-green)](https://gitter.im/openMVG/Lobby) |
| [![GitHub license](https://img.shields.io/badge/license-MPL2-blue)](https://github.com/openMVG/openMVG/blob/master/LICENSE) | [![doc](https://img.shields.io/badge/doc-readthedocs-blueviolet)](http://openmvg.readthedocs.org/en/latest) <br> [Wiki](https://github.com/openMVG/openMVG/wiki) | [![CI](https://github.com/openMVG/openMVG/actions/workflows/compile_and_run_test.yml/badge.svg?branch=develop)](https://github.com/openMVG/openMVG/actions/workflows/compile_and_run_test.yml) | [local/docker build tutorial ](https://github.com/openMVG/openMVG/blob/master/BUILD.md)| [![CodeQL](https://github.com/openMVG/openMVG/actions/workflows/codeql.yml/badge.svg)](https://github.com/openMVG/openMVG/actions/workflows/codeql.yml) <br> [![CodeFactor](https://www.codefactor.io/repository/github/openmvg/openmvg/badge)](https://www.codefactor.io/repository/github/openmvg/openmvg) | [![Join the chat](https://img.shields.io/badge/chat-on%20gitter-green)](https://gitter.im/openMVG/Lobby) |

**Our Mission**
- Extend awareness of the power of 3D reconstruction from images/photogrammetry by developing a C++ framework.
Expand Down
3 changes: 1 addition & 2 deletions external/openMVG/src/openMVG/multiview/triangulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ bool TriangulateDLT
P0.block<3,1>(0,3) = t0;
P1.block<3,1>(0,3) = t1;
TriangulateDLT(P0, x0, P1, x1, X);
return x0.dot(R0 * (*X + R0.transpose() * t0)) > 0.0 &&
x1.dot(R1 * (*X + R1.transpose() * t1)) > 0.0;
return (R0*(*X) + t0)(2) > 0.0 && (R1*(*X) + t1)(2) > 0.0;
}

// Helper function
Expand Down
57 changes: 37 additions & 20 deletions external/openMVG/src/openMVG/sfm/sfm_data_BA_ceres.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
namespace openMVG {
namespace sfm {

#define OPENMVG_CERES_HAS_MANIFOLD ((CERES_VERSION_MAJOR * 100 + CERES_VERSION_MINOR) >= 201)

using namespace openMVG::cameras;
using namespace openMVG::geometry;

Expand Down Expand Up @@ -112,9 +114,11 @@ Bundle_Adjustment_Ceres::BA_Ceres_options::BA_Ceres_options
)
: bVerbose_(bVerbose),
nb_threads_(1),
parameter_tolerance_(1e-8), //~= numeric_limits<float>::epsilon()
parameter_tolerance_(1e-8),
gradient_tolerance_(1e-10),
bUse_loss_function_(true),
max_num_iterations_(500)
max_num_iterations_(50),
max_linear_solver_iterations_(500)
{
#ifdef OPENMVG_USE_OPENMP
nb_threads_ = omp_get_max_threads();
Expand All @@ -136,12 +140,6 @@ Bundle_Adjustment_Ceres::BA_Ceres_options::BA_Ceres_options
}
else
{
if (ceres::IsSparseLinearAlgebraLibraryTypeAvailable(ceres::CX_SPARSE))
{
sparse_linear_algebra_library_type_ = ceres::CX_SPARSE;
linear_solver_type_ = ceres::SPARSE_SCHUR;
}
else
if (ceres::IsSparseLinearAlgebraLibraryTypeAvailable(ceres::EIGEN_SPARSE))
{
sparse_linear_algebra_library_type_ = ceres::EIGEN_SPARSE;
Expand Down Expand Up @@ -241,7 +239,18 @@ bool Bundle_Adjustment_Ceres::Adjust
}
}

ceres::Problem problem;
ceres::Problem::Options problem_options;

// Set a LossFunction to be less penalized by false measurements
// - set it to nullptr if you don't want use a lossFunction.
std::unique_ptr<ceres::LossFunction> p_LossFunction;
if (ceres_options_.bUse_loss_function_)
{
p_LossFunction.reset(new ceres::HuberLoss(Square(4.0)));
problem_options.loss_function_ownership = ceres::DO_NOT_TAKE_OWNERSHIP;
}

ceres::Problem problem(problem_options);

// Data wrapper for refinement:
Hash_Map<IndexT, std::vector<double>> map_intrinsics;
Expand Down Expand Up @@ -285,9 +294,14 @@ bool Bundle_Adjustment_Ceres::Adjust
}
if (!vec_constant_extrinsic.empty())
{
ceres::SubsetParameterization *subset_parameterization =
#if OPENMVG_CERES_HAS_MANIFOLD
auto* subset_manifold = new ceres::SubsetManifold(6, vec_constant_extrinsic);
problem.SetManifold(parameter_block, subset_manifold);
#else
auto *subset_parameterization =
new ceres::SubsetParameterization(6, vec_constant_extrinsic);
problem.SetParameterization(parameter_block, subset_parameterization);
#endif
}
}
}
Expand Down Expand Up @@ -315,10 +329,17 @@ bool Bundle_Adjustment_Ceres::Adjust
intrinsic_it.second->subsetParameterization(options.intrinsics_opt);
if (!vec_constant_intrinsic.empty())
{
ceres::SubsetParameterization *subset_parameterization =
#if OPENMVG_CERES_HAS_MANIFOLD
auto* subset_manifold =
new ceres::SubsetManifold(
map_intrinsics.at(indexCam).size(), vec_constant_intrinsic);
problem.SetManifold(parameter_block, subset_manifold);
#else
auto *subset_parameterization =
new ceres::SubsetParameterization(
map_intrinsics.at(indexCam).size(), vec_constant_intrinsic);
problem.SetParameterization(parameter_block, subset_parameterization);
#endif
}
}
}
Expand All @@ -329,13 +350,6 @@ bool Bundle_Adjustment_Ceres::Adjust
}
}

// Set a LossFunction to be less penalized by false measurements
// - set it to nullptr if you don't want use a lossFunction.
ceres::LossFunction * p_LossFunction =
ceres_options_.bUse_loss_function_ ?
new ceres::HuberLoss(Square(4.0))
: nullptr;

// For all visibility add reprojections errors:
for (auto & structure_landmark_it : sfm_data.structure)
{
Expand All @@ -358,15 +372,15 @@ bool Bundle_Adjustment_Ceres::Adjust
if (!map_intrinsics.at(view->id_intrinsic).empty())
{
problem.AddResidualBlock(cost_function,
p_LossFunction,
p_LossFunction.get(),
&map_intrinsics.at(view->id_intrinsic)[0],
&map_poses.at(view->id_pose)[0],
structure_landmark_it.second.X.data());
}
else
{
problem.AddResidualBlock(cost_function,
p_LossFunction,
p_LossFunction.get(),
&map_poses.at(view->id_pose)[0],
structure_landmark_it.second.X.data());
}
Expand Down Expand Up @@ -462,6 +476,7 @@ bool Bundle_Adjustment_Ceres::Adjust
// Make Ceres automatically detect the bundle structure.
ceres::Solver::Options ceres_config_options;
ceres_config_options.max_num_iterations = ceres_options_.max_num_iterations_;
ceres_config_options.max_linear_solver_iterations = ceres_options_.max_linear_solver_iterations_;
ceres_config_options.preconditioner_type =
static_cast<ceres::PreconditionerType>(ceres_options_.preconditioner_type_);
ceres_config_options.linear_solver_type =
Expand All @@ -475,6 +490,8 @@ bool Bundle_Adjustment_Ceres::Adjust
ceres_config_options.num_linear_solver_threads = ceres_options_.nb_threads_;
#endif
ceres_config_options.parameter_tolerance = ceres_options_.parameter_tolerance_;
ceres_config_options.gradient_tolerance = ceres_options_.gradient_tolerance_;


// Solve BA
ceres::Solver::Summary summary;
Expand Down
2 changes: 2 additions & 0 deletions external/openMVG/src/openMVG/sfm/sfm_data_BA_ceres.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ class Bundle_Adjustment_Ceres : public Bundle_Adjustment
int preconditioner_type_;
int sparse_linear_algebra_library_type_;
double parameter_tolerance_;
double gradient_tolerance_;
bool bUse_loss_function_;
int max_num_iterations_;
int max_linear_solver_iterations_;

BA_Ceres_options(const bool bVerbose = true, bool bmultithreaded = true);
};
Expand Down
30 changes: 2 additions & 28 deletions external/openMVG/src/openMVG/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,15 @@
#ifndef OPENMVG_TYPES_HPP
#define OPENMVG_TYPES_HPP

#ifndef OPENMVG_STD_UNORDERED_MAP

#include <Eigen/Core>

#endif

#include <algorithm>
#include <cstdint>
#include <functional>
#include <limits>
#include <map>
#include <set>
#include <vector>

#ifdef OPENMVG_STD_UNORDERED_MAP

#include <algorithm>
#include <unordered_map>
#include <utility>
#include <vector>

#include "openMVG/stl/hash.hpp"
namespace std {
Expand All @@ -46,8 +37,6 @@ namespace std {
};
}

#endif // OPENMVG_STD_UNORDERED_MAP

/**
* @brief Main namespace of openMVG API
*/
Expand All @@ -69,8 +58,6 @@ using Pair_Set = std::set<Pair>;
/// Vector of Pair
using Pair_Vec = std::vector<Pair>;

#if defined OPENMVG_STD_UNORDERED_MAP

/**
* @brief Standard Hash_Map class
* @tparam K type of the keys
Expand All @@ -79,19 +66,6 @@ using Pair_Vec = std::vector<Pair>;
template<typename Key, typename Value>
using Hash_Map = std::unordered_map<Key, Value>;

#else

/**
* @brief Standard Hash_Map class
* @tparam K type of the keys
* @tparam V type of the values
*/
template<typename Key, typename Value>
using Hash_Map = std::map<Key, Value, std::less<Key>,
Eigen::aligned_allocator<std::pair<const Key, Value>>>;

#endif // OPENMVG_STD_UNORDERED_MAP

} // namespace openMVG

#endif // OPENMVG_TYPES_HPP
4 changes: 2 additions & 2 deletions external/openMVG/src/openMVG/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
#define OPENMVG_VERSION_HPP

#define OPENMVG_VERSION_MAJOR 2
#define OPENMVG_VERSION_MINOR 0
#define OPENMVG_VERSION_MINOR 1
#define OPENMVG_VERSION_REVISION 0

// Preprocessor to string conversion
#define OPENMVG_TO_STRING_HELPER(x) #x
#define OPENMVG_TO_STRING(x) OPENMVG_TO_STRING_HELPER(x)

// OpenMVG version as a string; for example "2.0.0".
// OpenMVG version as a string; for example "2.1.0".
#define OPENMVG_VERSION_STRING OPENMVG_TO_STRING(OPENMVG_VERSION_MAJOR) "." \
OPENMVG_TO_STRING(OPENMVG_VERSION_MINOR) "." \
OPENMVG_TO_STRING(OPENMVG_VERSION_REVISION)
Expand Down
20 changes: 20 additions & 0 deletions python/mmSolver/tools/surfacecluster/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (C) 2024 David Cattermole.
#
# This file is part of mmSolver.
#
# mmSolver is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# mmSolver is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with mmSolver. If not, see <https://www.gnu.org/licenses/>.
#
"""
Surface Cluster tool.
"""
2 changes: 1 addition & 1 deletion share/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black==22.3.0
black==24.3.0
pylint==2.13.9
flake8==4.0.1
cpplint==1.6.0
Loading

0 comments on commit 0be5852

Please sign in to comment.