From d1dd1238c5d763bda67ce6ffb7221d6f1d443679 Mon Sep 17 00:00:00 2001 From: B1ueber2y Date: Tue, 18 Mar 2025 13:58:24 +0100 Subject: [PATCH 1/7] minor cosmetics --- limap/base/bindings.cc | 6 +++--- limap/base/camera.h | 9 ++++----- limap/base/line_dists.cc | 4 ++++ limap/util/simple_logger.h | 4 ++-- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/limap/base/bindings.cc b/limap/base/bindings.cc index 102d6a8f..c1513b8a 100644 --- a/limap/base/bindings.cc +++ b/limap/base/bindings.cc @@ -804,7 +804,7 @@ void bind_camera(py::module &m) { .def(py::init(), R"( Default constructor: identity pose )", - py::arg("initialized") = false) + py::arg("init") = false) .def(py::init(), R"( Copy constructor )", @@ -812,11 +812,11 @@ void bind_camera(py::module &m) { .def(py::init(), R"( Constructor from a quaternion vector and a translation vector )", - py::arg("qvec"), py::arg("tvec"), py::arg("initialized") = true) + py::arg("qvec"), py::arg("tvec"), py::arg("init") = true) .def(py::init(), R"( Constructor from a rotation matrix and a translation vector )", - py::arg("R"), py::arg("tvec"), py::arg("initialized") = true) + py::arg("R"), py::arg("tvec"), py::arg("init") = true) .def(py::init(), R"( Constructor from a Python dict )", diff --git a/limap/base/camera.h b/limap/base/camera.h index ac8a29dd..b60a506e 100644 --- a/limap/base/camera.h +++ b/limap/base/camera.h @@ -87,11 +87,10 @@ class Camera : public colmap::Camera { class CameraPose { public: - CameraPose(bool initialized = false) : initialized(initialized) {} - CameraPose(V4D qvec, V3D tvec, bool initialized = true) - : qvec(qvec.normalized()), tvec(tvec), initialized(initialized) {} - CameraPose(M3D R, V3D T, bool initiallized = true) - : tvec(T), initialized(initialized) { + CameraPose(bool init = false) : initialized(init) {} + CameraPose(V4D qvec, V3D tvec, bool init = true) + : qvec(qvec.normalized()), tvec(tvec), initialized(init) {} + CameraPose(M3D R, V3D t, bool init = true) : tvec(t), initialized(init) { qvec = RotationMatrixToQuaternion(R); } CameraPose(py::dict dict); diff --git a/limap/base/line_dists.cc b/limap/base/line_dists.cc index ee76d014..ab771346 100644 --- a/limap/base/line_dists.cc +++ b/limap/base/line_dists.cc @@ -218,6 +218,8 @@ double compute_distance(const Line2d &l1, const Line2d &l2, case LineDistType::ENDPOINTS_SCALEINV: throw std::runtime_error( "Type error. Scale invariance distance is not supported for Line2d."); + default: + throw std::runtime_error("Distance type not supported."); } return -1.0; } @@ -260,6 +262,8 @@ double compute_distance(const Line3d &l1, const Line3d &l2, return dist_endpoints_scaleinv_oneway(l1, l2); case LineDistType::ENDPOINTS_SCALEINV: return dist_endpoints_scaleinv(l1, l2); + default: + throw std::runtime_error("Distance type not supported."); } return -1.0; } diff --git a/limap/util/simple_logger.h b/limap/util/simple_logger.h index f150b6ec..4051a1ba 100644 --- a/limap/util/simple_logger.h +++ b/limap/util/simple_logger.h @@ -170,7 +170,7 @@ class LogProgressbar : public progressbar { if (update_is_called) progress += inc; std::string out = get_update_str(); - if (out.c_str() != "\r") { + if (out != "\r") { STDLOG(CERR) << out; } } @@ -189,7 +189,7 @@ class SyncLogProgressbar : public progressbar { if (update_is_called) progress += inc; std::string out = get_update_str(); - if (out.c_str() != "\r") { + if (out != "\r") { SYNC_LOG(CERR) << out; } } From 568463f37aa9f834354ae976f330f1bc5adc72ee Mon Sep 17 00:00:00 2001 From: B1ueber2y Date: Tue, 18 Mar 2025 13:58:46 +0100 Subject: [PATCH 2/7] update jlinkage. disable gui and lsd for colmap --- cmake/FindDependencies.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/FindDependencies.cmake b/cmake/FindDependencies.cmake index 75a05875..61e72f92 100644 --- a/cmake/FindDependencies.cmake +++ b/cmake/FindDependencies.cmake @@ -54,6 +54,8 @@ endif() message(STATUS "Configuring PoseLib... done") # COLMAP +set(GUI_ENABLED OFF CACHE BOOL "Disable GUI" FORCE) +set(LSD_ENABLED OFF CACHE BOOL "Disable LSD in COLMAP" FORCE) FetchContent_Declare(COLMAP GIT_REPOSITORY https://github.com/colmap/colmap.git GIT_TAG c9097b031ee00da22609c7ac4b3f6b45b4178de2 @@ -70,7 +72,7 @@ message(STATUS "Configuring COLMAP... done") # JLinkage FetchContent_Declare(JLinkage GIT_REPOSITORY https://github.com/B1ueber2y/JLinkage.git - GIT_TAG 452d67eda005db01a02071a5af8f0eced0a02079 + GIT_TAG 75dadd555f81b1cf1b0f016d8cac76f3b554ba9b EXCLUDE_FROM_ALL ) message(STATUS "Configuring JLinkage...") From 9d9138d521ccb75d59ae25a293b63c4fed757746 Mon Sep 17 00:00:00 2001 From: B1ueber2y Date: Tue, 18 Mar 2025 14:42:42 +0100 Subject: [PATCH 3/7] try --- limap/base/bindings.cc | 6 +++--- limap/base/camera.h | 9 +++++---- limap/base/line_dists.cc | 4 ---- limap/util/simple_logger.h | 4 ++-- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/limap/base/bindings.cc b/limap/base/bindings.cc index c1513b8a..102d6a8f 100644 --- a/limap/base/bindings.cc +++ b/limap/base/bindings.cc @@ -804,7 +804,7 @@ void bind_camera(py::module &m) { .def(py::init(), R"( Default constructor: identity pose )", - py::arg("init") = false) + py::arg("initialized") = false) .def(py::init(), R"( Copy constructor )", @@ -812,11 +812,11 @@ void bind_camera(py::module &m) { .def(py::init(), R"( Constructor from a quaternion vector and a translation vector )", - py::arg("qvec"), py::arg("tvec"), py::arg("init") = true) + py::arg("qvec"), py::arg("tvec"), py::arg("initialized") = true) .def(py::init(), R"( Constructor from a rotation matrix and a translation vector )", - py::arg("R"), py::arg("tvec"), py::arg("init") = true) + py::arg("R"), py::arg("tvec"), py::arg("initialized") = true) .def(py::init(), R"( Constructor from a Python dict )", diff --git a/limap/base/camera.h b/limap/base/camera.h index b60a506e..ac8a29dd 100644 --- a/limap/base/camera.h +++ b/limap/base/camera.h @@ -87,10 +87,11 @@ class Camera : public colmap::Camera { class CameraPose { public: - CameraPose(bool init = false) : initialized(init) {} - CameraPose(V4D qvec, V3D tvec, bool init = true) - : qvec(qvec.normalized()), tvec(tvec), initialized(init) {} - CameraPose(M3D R, V3D t, bool init = true) : tvec(t), initialized(init) { + CameraPose(bool initialized = false) : initialized(initialized) {} + CameraPose(V4D qvec, V3D tvec, bool initialized = true) + : qvec(qvec.normalized()), tvec(tvec), initialized(initialized) {} + CameraPose(M3D R, V3D T, bool initiallized = true) + : tvec(T), initialized(initialized) { qvec = RotationMatrixToQuaternion(R); } CameraPose(py::dict dict); diff --git a/limap/base/line_dists.cc b/limap/base/line_dists.cc index ab771346..ee76d014 100644 --- a/limap/base/line_dists.cc +++ b/limap/base/line_dists.cc @@ -218,8 +218,6 @@ double compute_distance(const Line2d &l1, const Line2d &l2, case LineDistType::ENDPOINTS_SCALEINV: throw std::runtime_error( "Type error. Scale invariance distance is not supported for Line2d."); - default: - throw std::runtime_error("Distance type not supported."); } return -1.0; } @@ -262,8 +260,6 @@ double compute_distance(const Line3d &l1, const Line3d &l2, return dist_endpoints_scaleinv_oneway(l1, l2); case LineDistType::ENDPOINTS_SCALEINV: return dist_endpoints_scaleinv(l1, l2); - default: - throw std::runtime_error("Distance type not supported."); } return -1.0; } diff --git a/limap/util/simple_logger.h b/limap/util/simple_logger.h index 4051a1ba..f150b6ec 100644 --- a/limap/util/simple_logger.h +++ b/limap/util/simple_logger.h @@ -170,7 +170,7 @@ class LogProgressbar : public progressbar { if (update_is_called) progress += inc; std::string out = get_update_str(); - if (out != "\r") { + if (out.c_str() != "\r") { STDLOG(CERR) << out; } } @@ -189,7 +189,7 @@ class SyncLogProgressbar : public progressbar { if (update_is_called) progress += inc; std::string out = get_update_str(); - if (out != "\r") { + if (out.c_str() != "\r") { SYNC_LOG(CERR) << out; } } From cb19f147c55d197c0e9b82dbcdad1574d821fcdc Mon Sep 17 00:00:00 2001 From: B1ueber2y Date: Tue, 18 Mar 2025 15:53:35 +0100 Subject: [PATCH 4/7] try --- cmake/FindDependencies.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/FindDependencies.cmake b/cmake/FindDependencies.cmake index 61e72f92..fba6ea1b 100644 --- a/cmake/FindDependencies.cmake +++ b/cmake/FindDependencies.cmake @@ -54,8 +54,8 @@ endif() message(STATUS "Configuring PoseLib... done") # COLMAP -set(GUI_ENABLED OFF CACHE BOOL "Disable GUI" FORCE) -set(LSD_ENABLED OFF CACHE BOOL "Disable LSD in COLMAP" FORCE) +# set(GUI_ENABLED OFF CACHE BOOL "Disable GUI" FORCE) +# set(LSD_ENABLED OFF CACHE BOOL "Disable LSD in COLMAP" FORCE) FetchContent_Declare(COLMAP GIT_REPOSITORY https://github.com/colmap/colmap.git GIT_TAG c9097b031ee00da22609c7ac4b3f6b45b4178de2 From 6c250b3d757e68fe89e19fd88425cbf6ca594a70 Mon Sep 17 00:00:00 2001 From: B1ueber2y Date: Tue, 18 Mar 2025 16:19:45 +0100 Subject: [PATCH 5/7] try --- cmake/FindDependencies.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindDependencies.cmake b/cmake/FindDependencies.cmake index fba6ea1b..b9892268 100644 --- a/cmake/FindDependencies.cmake +++ b/cmake/FindDependencies.cmake @@ -54,7 +54,7 @@ endif() message(STATUS "Configuring PoseLib... done") # COLMAP -# set(GUI_ENABLED OFF CACHE BOOL "Disable GUI" FORCE) +set(GUI_ENABLED OFF CACHE BOOL "Disable GUI" FORCE) # set(LSD_ENABLED OFF CACHE BOOL "Disable LSD in COLMAP" FORCE) FetchContent_Declare(COLMAP GIT_REPOSITORY https://github.com/colmap/colmap.git From 7fbedfb150f559997fc61a1bfcc7b065d9ff9a7f Mon Sep 17 00:00:00 2001 From: B1ueber2y Date: Tue, 18 Mar 2025 16:37:45 +0100 Subject: [PATCH 6/7] try --- cmake/FindDependencies.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/FindDependencies.cmake b/cmake/FindDependencies.cmake index b9892268..cec0c3ec 100644 --- a/cmake/FindDependencies.cmake +++ b/cmake/FindDependencies.cmake @@ -54,8 +54,8 @@ endif() message(STATUS "Configuring PoseLib... done") # COLMAP -set(GUI_ENABLED OFF CACHE BOOL "Disable GUI" FORCE) -# set(LSD_ENABLED OFF CACHE BOOL "Disable LSD in COLMAP" FORCE) +# set(GUI_ENABLED OFF CACHE BOOL "Disable GUI" FORCE) +set(LSD_ENABLED OFF CACHE BOOL "Disable LSD in COLMAP" FORCE) FetchContent_Declare(COLMAP GIT_REPOSITORY https://github.com/colmap/colmap.git GIT_TAG c9097b031ee00da22609c7ac4b3f6b45b4178de2 From cf1d9b7f76503e57f180bad4264253d312a6701a Mon Sep 17 00:00:00 2001 From: B1ueber2y Date: Tue, 18 Mar 2025 18:56:28 +0100 Subject: [PATCH 7/7] finalize --- cmake/FindDependencies.cmake | 1 - limap/base/bindings.cc | 6 +++--- limap/base/camera.h | 9 ++++----- limap/base/line_dists.cc | 4 ++++ limap/util/simple_logger.h | 4 ++-- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmake/FindDependencies.cmake b/cmake/FindDependencies.cmake index cec0c3ec..f35171a9 100644 --- a/cmake/FindDependencies.cmake +++ b/cmake/FindDependencies.cmake @@ -54,7 +54,6 @@ endif() message(STATUS "Configuring PoseLib... done") # COLMAP -# set(GUI_ENABLED OFF CACHE BOOL "Disable GUI" FORCE) set(LSD_ENABLED OFF CACHE BOOL "Disable LSD in COLMAP" FORCE) FetchContent_Declare(COLMAP GIT_REPOSITORY https://github.com/colmap/colmap.git diff --git a/limap/base/bindings.cc b/limap/base/bindings.cc index 102d6a8f..c1513b8a 100644 --- a/limap/base/bindings.cc +++ b/limap/base/bindings.cc @@ -804,7 +804,7 @@ void bind_camera(py::module &m) { .def(py::init(), R"( Default constructor: identity pose )", - py::arg("initialized") = false) + py::arg("init") = false) .def(py::init(), R"( Copy constructor )", @@ -812,11 +812,11 @@ void bind_camera(py::module &m) { .def(py::init(), R"( Constructor from a quaternion vector and a translation vector )", - py::arg("qvec"), py::arg("tvec"), py::arg("initialized") = true) + py::arg("qvec"), py::arg("tvec"), py::arg("init") = true) .def(py::init(), R"( Constructor from a rotation matrix and a translation vector )", - py::arg("R"), py::arg("tvec"), py::arg("initialized") = true) + py::arg("R"), py::arg("tvec"), py::arg("init") = true) .def(py::init(), R"( Constructor from a Python dict )", diff --git a/limap/base/camera.h b/limap/base/camera.h index ac8a29dd..b60a506e 100644 --- a/limap/base/camera.h +++ b/limap/base/camera.h @@ -87,11 +87,10 @@ class Camera : public colmap::Camera { class CameraPose { public: - CameraPose(bool initialized = false) : initialized(initialized) {} - CameraPose(V4D qvec, V3D tvec, bool initialized = true) - : qvec(qvec.normalized()), tvec(tvec), initialized(initialized) {} - CameraPose(M3D R, V3D T, bool initiallized = true) - : tvec(T), initialized(initialized) { + CameraPose(bool init = false) : initialized(init) {} + CameraPose(V4D qvec, V3D tvec, bool init = true) + : qvec(qvec.normalized()), tvec(tvec), initialized(init) {} + CameraPose(M3D R, V3D t, bool init = true) : tvec(t), initialized(init) { qvec = RotationMatrixToQuaternion(R); } CameraPose(py::dict dict); diff --git a/limap/base/line_dists.cc b/limap/base/line_dists.cc index ee76d014..ab771346 100644 --- a/limap/base/line_dists.cc +++ b/limap/base/line_dists.cc @@ -218,6 +218,8 @@ double compute_distance(const Line2d &l1, const Line2d &l2, case LineDistType::ENDPOINTS_SCALEINV: throw std::runtime_error( "Type error. Scale invariance distance is not supported for Line2d."); + default: + throw std::runtime_error("Distance type not supported."); } return -1.0; } @@ -260,6 +262,8 @@ double compute_distance(const Line3d &l1, const Line3d &l2, return dist_endpoints_scaleinv_oneway(l1, l2); case LineDistType::ENDPOINTS_SCALEINV: return dist_endpoints_scaleinv(l1, l2); + default: + throw std::runtime_error("Distance type not supported."); } return -1.0; } diff --git a/limap/util/simple_logger.h b/limap/util/simple_logger.h index f150b6ec..4051a1ba 100644 --- a/limap/util/simple_logger.h +++ b/limap/util/simple_logger.h @@ -170,7 +170,7 @@ class LogProgressbar : public progressbar { if (update_is_called) progress += inc; std::string out = get_update_str(); - if (out.c_str() != "\r") { + if (out != "\r") { STDLOG(CERR) << out; } } @@ -189,7 +189,7 @@ class SyncLogProgressbar : public progressbar { if (update_is_called) progress += inc; std::string out = get_update_str(); - if (out.c_str() != "\r") { + if (out != "\r") { SYNC_LOG(CERR) << out; } }