-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove COLMAP factors and dependency (#32)
- Loading branch information
Showing
10 changed files
with
44 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION}) | ||
|
||
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) | ||
set(CMAKE_CUDA_ARCHITECTURES "native") | ||
endif() | ||
find_package(COLMAP REQUIRED) | ||
if(${COLMAP_VERSION} VERSION_LESS "3.9.0") | ||
message( SEND_ERROR "COLMAP version >= 3.9.0 required, found ${COLMAP_VERSION}." ) | ||
find_package(Ceres REQUIRED) | ||
if(NOT TARGET Ceres::ceres) | ||
# Older Ceres versions don't come with an imported interface target. | ||
add_library(Ceres::ceres INTERFACE IMPORTED) | ||
target_include_directories( | ||
Ceres::ceres INTERFACE ${CERES_INCLUDE_DIRS}) | ||
target_link_libraries( | ||
Ceres::ceres INTERFACE ${CERES_LIBRARIES}) | ||
endif() | ||
if(${CERES_VERSION} VERSION_LESS "2.1.0") | ||
message( SEND_ERROR "Ceres version >= 2.1 required, found ${CERES_VERSION}." ) | ||
endif() | ||
|
||
|
||
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module) | ||
|
||
find_package(pybind11 2.11.1 REQUIRED) | ||
|
||
pybind11_add_module(pyceres _pyceres/bindings.cc) | ||
target_include_directories(pyceres PRIVATE ${PROJECT_SOURCE_DIR}) | ||
target_link_libraries(pyceres PRIVATE colmap::colmap glog::glog Ceres::ceres) | ||
target_link_libraries(pyceres PRIVATE glog::glog Ceres::ceres) | ||
target_compile_definitions(pyceres PRIVATE VERSION_INFO="${PROJECT_VERSION}") | ||
install(TARGETS pyceres LIBRARY DESTINATION .) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,24 @@ | ||
#pragma once | ||
|
||
#include "_pyceres/factors/bundle.h" | ||
#include "_pyceres/factors/common.h" | ||
#include "_pyceres/factors/pose_graph.h" | ||
#include "_pyceres/helpers.h" | ||
|
||
#include <ceres/ceres.h> | ||
#include <ceres/normal_prior.h> | ||
#include <pybind11/eigen.h> | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
namespace py = pybind11; | ||
using namespace colmap; | ||
|
||
void bind_factors(py::module& m) { | ||
m.def("ReprojErrorCost", | ||
&CreateCostFunction<ReprojErrorCostFunction, const Eigen::Vector2d&>, | ||
py::arg("camera_model_id"), | ||
py::arg("point2D")); | ||
m.def("ReprojErrorCost", | ||
&CreateCostFunction<ReprojErrorCostFunctionWithNoise, | ||
const Eigen::Vector2d&, | ||
const double>, | ||
py::arg("camera_model_id"), | ||
py::arg("point2D"), | ||
py::arg("stddev")); | ||
m.def("ReprojErrorCost", | ||
&CreateCostFunction<ReprojErrorConstantPoseCostFunction, | ||
const Rigid3d&, | ||
const Eigen::Vector2d&>, | ||
py::arg("camera_model_id"), | ||
py::arg("cam_from_world"), | ||
py::arg("point2D")); | ||
m.def("ReprojErrorCost", | ||
&CreateCostFunction<ReprojErrorConstantPoseCostFunctionWithNoise, | ||
const Rigid3d&, | ||
const Eigen::Vector2d&, | ||
const double>, | ||
py::arg("camera_model_id"), | ||
py::arg("cam_from_world"), | ||
py::arg("point2D"), | ||
py::arg("stddev")); | ||
|
||
m.def("RigReprojErrorCost", | ||
&CreateCostFunction<RigReprojErrorCostFunction, const Eigen::Vector2d&>, | ||
py::arg("camera_model_id"), | ||
py::arg("point2D")); | ||
m.def("RigReprojErrorCost", | ||
&CreateCostFunction<RigReprojErrorCostFunctionWithNoise, | ||
const Eigen::Vector2d&, | ||
const double>, | ||
py::arg("camera_model_id"), | ||
py::arg("point2D"), | ||
py::arg("stddev")); | ||
m.def("RigReprojErrorCost", | ||
&CreateCostFunction<RigReprojErrorConstantRigCostFunction, | ||
const Rigid3d&, | ||
const Eigen::Vector2d&>, | ||
py::arg("camera_model_id"), | ||
py::arg("cam_from_rig"), | ||
py::arg("point2D")); | ||
m.def("RigReprojErrorCost", | ||
&CreateCostFunction<RigReprojErrorConstantRigCostFunctionWithNoise, | ||
const Rigid3d&, | ||
const Eigen::Vector2d&, | ||
const double>, | ||
py::arg("camera_model_id"), | ||
py::arg("cam_from_rig"), | ||
py::arg("point2D"), | ||
py::arg("stddev")); | ||
|
||
m.def("PoseGraphRelativeCost", | ||
&PoseGraphRelativeCost::Create, | ||
py::arg("j_from_i"), | ||
py::arg("covariance")); | ||
m.def("PoseGraphAbsoluteCost", | ||
&PoseGraphAbsoluteCost::Create, | ||
py::arg("cam_from_world"), | ||
py::arg("covariance")); | ||
|
||
m.def("NormalPrior", | ||
&CreateNormalPrior, | ||
py::arg("mean"), | ||
py::arg("covariance")); | ||
m.def( | ||
"NormalPrior", | ||
[](const Eigen::VectorXd& mean, | ||
const Eigen::Matrix<double, -1, -1>& covariance) { | ||
THROW_CHECK_EQ(covariance.cols(), mean.size()); | ||
THROW_CHECK_EQ(covariance.cols(), covariance.rows()); | ||
return new ceres::NormalPrior(covariance.inverse().llt().matrixL(), | ||
mean); | ||
}, | ||
py::arg("mean"), | ||
py::arg("covariance")); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.