mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 16:40:38 +08:00
Take abseil as a dependency
1. Add abseil-cpp as a submodule. We are tracking the latest LTS release, which is lts_2024_01_16. 2. Replace glog/gflags with absl::log and absl::flags. 3. Remove miniglog 4. Also take a whack at making the bazel build work with abseil-cpp and gtest. There are a number of TODOs in this CL that still need to be resolved. Change-Id: I39355ed7d61375be4ebcbc8596d9cc70acc1c678
This commit is contained in:
@@ -113,20 +113,24 @@ typedef unsigned __int32 uint32_t;
|
||||
|
||||
#endif
|
||||
|
||||
#include "absl/flags/flag.h"
|
||||
#include "absl/flags/parse.h"
|
||||
#include "absl/log/check.h"
|
||||
#include "absl/log/initialize.h"
|
||||
#include "absl/log/log.h"
|
||||
#include "ceres/ceres.h"
|
||||
#include "ceres/rotation.h"
|
||||
#include "gflags/gflags.h"
|
||||
#include "glog/logging.h"
|
||||
|
||||
using Mat3 = Eigen::Matrix<double, 3, 3>;
|
||||
using Vec6 = Eigen::Matrix<double, 6, 1>;
|
||||
using Vec3 = Eigen::Vector3d;
|
||||
using Vec4 = Eigen::Vector4d;
|
||||
|
||||
DEFINE_string(input, "", "Input File name");
|
||||
DEFINE_string(refine_intrinsics,
|
||||
"",
|
||||
"Camera intrinsics to be refined. Options are: none, radial.");
|
||||
ABSL_FLAG(std::string, input, "", "Input File name");
|
||||
ABSL_FLAG(std::string,
|
||||
refine_intrinsics,
|
||||
"",
|
||||
"Camera intrinsics to be refined. Options are: none, radial.");
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -791,10 +795,10 @@ void EuclideanBundleCommonIntrinsics(const std::vector<Marker>& all_markers,
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
|
||||
google::InitGoogleLogging(argv[0]);
|
||||
absl::InitializeLog();
|
||||
absl::ParseCommandLine(argc, argv);
|
||||
|
||||
if (CERES_GET_FLAG(FLAGS_input).empty()) {
|
||||
if (absl::GetFlag(FLAGS_input).empty()) {
|
||||
LOG(ERROR) << "Usage: libmv_bundle_adjuster --input=blender_problem";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -805,7 +809,7 @@ int main(int argc, char** argv) {
|
||||
bool is_image_space;
|
||||
std::vector<Marker> all_markers;
|
||||
|
||||
if (!ReadProblemFromFile(CERES_GET_FLAG(FLAGS_input),
|
||||
if (!ReadProblemFromFile(absl::GetFlag(FLAGS_input),
|
||||
camera_intrinsics,
|
||||
&all_cameras,
|
||||
&all_points,
|
||||
@@ -829,14 +833,14 @@ int main(int argc, char** argv) {
|
||||
// declare which intrinsics need to be refined and in this case
|
||||
// refining flags does not depend on problem at all.
|
||||
int bundle_intrinsics = BUNDLE_NO_INTRINSICS;
|
||||
if (CERES_GET_FLAG(FLAGS_refine_intrinsics).empty()) {
|
||||
if (absl::GetFlag(FLAGS_refine_intrinsics).empty()) {
|
||||
if (is_image_space) {
|
||||
bundle_intrinsics = BUNDLE_FOCAL_LENGTH | BUNDLE_RADIAL;
|
||||
}
|
||||
} else {
|
||||
if (CERES_GET_FLAG(FLAGS_refine_intrinsics) == "radial") {
|
||||
if (absl::GetFlag(FLAGS_refine_intrinsics) == "radial") {
|
||||
bundle_intrinsics = BUNDLE_FOCAL_LENGTH | BUNDLE_RADIAL;
|
||||
} else if (CERES_GET_FLAG(FLAGS_refine_intrinsics) != "none") {
|
||||
} else if (absl::GetFlag(FLAGS_refine_intrinsics) != "none") {
|
||||
LOG(ERROR) << "Unsupported value for refine-intrinsics";
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user