Commit Graph

22 Commits

Author SHA1 Message Date
Sameer Agarwal 0ca2db57c7 Fix a number of typos
Change-Id: I0038f9c91dc70c422c01305dc10fca5a22a2f0d0
2024-07-21 15:15:36 -07:00
Sameer Agarwal 0a53aa9054 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
2024-07-18 00:24:49 -07:00
Sergiu Deitsch 4893392195 Rework MSVC warning suppression
Previously, MSVC warning C4996 was suppressed unconditionally in the
entire code base which made it difficult identifying and fixing specific
problems, particularly those in the public interface.

Prefer now to disable warnings at the specific location they occur. This
approach, however, reveals an inconsistency in how Ceres handles POSIX
functions which are declared deprecated by MSVC. Specifically, Bessel
functions use the underscore form whereas the read function does not. To
simplify the logic, we revert to POSIX compatible functions.

C++23 also deprecates std::numeric_limits<T>::has_denorm which MSVC
warns about. Here, we disable the deprecation warning locally to avoid
the warning leaking into the user code.

Fixes #1013

Change-Id: Ida8457cc8dd8770b4384a7c49d16f213b02cdec4
2023-09-30 13:37:39 +02:00
Sameer Agarwal 9602ed7b76 ClangFormat changes
Change-Id: I88c9e38b0450aed26c60e1dd54964ab6571e3eef
2023-01-14 05:54:24 -08:00
Alexander Ivanov 53df5ddcfd Removing using std::...
Change-Id: I584402e2a34869183c1d59071a15d97b216c52fb
2023-01-11 16:51:38 +00:00
Sergiu Deitsch 027e741a1a Eliminated MinGW warning
Change-Id: I35a852e742cc7d678c3af40e1bcd8a4f962303ee
2022-06-26 05:09:09 +00:00
Evan Levine f1414cb5bd Correct spelling in comments and docs.
Change-Id: Iad9a0599d644d3b3cd54244edaf64d408cb1308e
2022-04-24 21:40:13 -07:00
Sergiu Deitsch c8658c8992 Modernize more
Apply clang-tidy Google and modernize fixes without trailing return type
using:

$ clang-tidy -p <build-dir> \
  -checks='-*,google-*,modernize-*,-modernize-use-trailing-return-type' {} -fix

Change-Id: I7450cc58ea9abf928f73a467e87876083217fa26
2022-02-26 22:16:56 +00:00
Sameer Agarwal 77c0c4d09c Migrate examples to use Manifolds
Also change NULL to nullptr.

Change-Id: I80a2328185d7891f61e07e64d5c1b59e74588ac7
2022-01-22 11:18:19 -08:00
Sameer Agarwal 98f639f542 Add a macro CERES_GET_FLAG.
This is needed to add a layer of indirection which will allow
us to use gflags in the public version and absl inside Google.

Change-Id: I32f3da23200a01c9b658bbf8aaa66cb8fddc2cc3
2021-03-18 11:07:57 -07:00
Nikolaus Demmel 7b6b2491cc fix formatting for examples
This is mostly just applying the existing clang format config, except:
- Use NOLINT on overlong comment lines.
- Wrap some sections in 'clang-format off' / 'clang format on'.
- Manually split or join some multi-line strings.

Change-Id: Ia1a40eeb92112e12c3a169309afe087af55b2f4f
2020-09-08 17:56:39 +02:00
Julian Kent 368a738e52 AutoDiffCostFunction: optional ownership
Add Ownership semantics to the AutoDiffCostFunction

This allows several benefits, such as pointer ordering always being the
same for numerical repeatability (due to blocks being ordered by
pointer address), memory adjacency for better cache performance, and
reduced allocator pressure / overhead.

This is then made use of in libmv by preallocating the errors and
cost functions into vectors

Change-Id: Ia5b97e7249b55a463264b6e26f7a02291927c9f2
2020-09-03 19:19:53 +02:00
Sameer Agarwal 57cf20aa5d static const -> static constexpr where we can.
Change-Id: I8a6d26a89c4377dd440fa6dcf23513b7556533fc
2020-04-21 10:13:27 -07:00
NeroBurner a548766d14 Use glfags target
Update the usage of Google Flags (gflags) library the same way Glog
updated it [1]. This pushes the minimum required gflags version to
v2.2.0.

Remove the ceres specific define of CERES_GFLAGS_NAMESPACE and directly
use GFLAGS_NAMESPACE defined in gflags/gflags_declare.h [2].

In CeresConfig.cmake the hard coded paths for gflags are ommited.
Instead we rely on the gflagsConfig file to get closer to a relocatable
CeresConfig.cmake.
Furthermore use the find_dependency() [4] cmake function specifically
created for cmake-config files.

This change builds upon the explicit PUBLIC/PRIVATE link change [3].

[1] https://github.com/google/glog/pull/199
[2] https://github.com/gflags/gflags/blob/d9b184bd0026b16bb4c2fded75d56fb2cce50d66/src/gflags_declare.h.in#L43
[3] https://ceres-solver-review.googlesource.com/c/ceres-solver/+/16220
[4] https://cmake.org/cmake/help/latest/module/CMakeFindDependencyMacro.html

Change-Id: I9861a2699f2702bf1a5e99d07863a7e6639b7c39
2019-12-12 14:00:59 +00:00
Sameer Agarwal d05515b3eb Remove spurious conversion from doubles to Jets.
Binary operations between Jets and doubles are well defined
and should not require an explicit conversion to Jets to work.
This was an oversight earlier and lead to overzealous conversions
all over our in our example code.

Change-Id: I1799770818e136edfc0a5802d86037ce9aec4923
2017-02-10 11:36:58 -08:00
Alex Stewart 9631c69354 Fix missing include in libmv_bundle_adjuster on OSX.
- If compiling without glog (but with gflags) on OSX, unistd.h is
  required for close() et al, when using glog this was pulled in
  indirectly.

Change-Id: I8f0807d98479e386921fb48da30683d027d4bc61
2014-11-29 16:38:59 +00:00
Alex Stewart cbe694505e Autodetect gflags namespace.
- At version 2.1, gflags changed from using the google namespace, to
  using gflags by default.  However, it can be configured at build time
  to be something else (which would be google for legacy compatibility
  unless you were evil).
- Ceres previously assumed that gflags was in the google namespace.
- Now, FindGFlags.cmake extracts the namespace when gflags.h is found
  and saves it in GFLAGS_NAMESPACE.
- When building the tests and examples that require gflags,
  CERES_GFLAGS_NAMESPACE is defined to be the detected namespace, and
  all tests/examples now use CERES_GFLAGS_NAMESPACE:: instead of
  google:: when calling gflags functions.

Change-Id: Ia333df7a7e2f08ba9f26bbd339c3a785b88f04c4
2014-11-27 09:56:37 +00:00
Arnaud Gelas 044786669d Enforce the read call returns correct value
fix compilation error on Ubuntu 12.0

In file included from /usr/include/fcntl.h:252:0,
                 from /home/ajg23/src/ceres-solver/examples/libmv_bundle_adjuster.cc:91:
/home/ajg23/src/ceres-solver/examples/libmv_bundle_adjuster.cc: In member function ‘T {anonymous}::EndianAwareFileReader::Read() const [with T = unsigned char]’:
/home/ajg23/src/ceres-solver/examples/libmv_bundle_adjuster.cc:300:5: error: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Werror=unused-result]

Change-Id: Ib23ca19778761bbfe0d77bcf32a2181ce6db1a12
2013-06-21 16:05:15 +02:00
Sameer Agarwal 85b7e9d3c1 Fix an uninitialized variable warning when building with GCC.
Change-Id: I6f24553a9c4dfb59e05778f19406aefa058b6342
2013-06-13 23:01:01 -07:00
Sameer Agarwal 4437639e9b Documentation updates.
1. Further tightening of the Covariance documentation.
2. Documented minimizer progress output.
3. Lint cleanup from William Rucklidge.
4. Updated version history.

Change-Id: I8bc28484675d4edf89a7c050b6379dbac6c39e91
2013-06-03 09:41:27 -07:00
Sameer Agarwal 0f6161ba60 Add a define for O_BINARY.
Also make libmv_bundle_adjuster more verbose by default.

Change-Id: Ie8c7c4d9eed737681382bcfe61e39174d5e3420d
2013-06-01 16:34:54 -07:00
Sergey Sharybin 9869c3dd44 Libmv bundle adjuster example application
Add example application which is based on bundle
adjustment code from Libmv library, which is heavily
used in Blender.

Apart from bundle adjustment code this commit also
contains real-life optimization problems from VFX
pipeline. This files are created from production
files of Tears of Steel movie.

New code is placed to examples, and could be used
either as an example implementation of BA or for
timing investigation of problems appearing in VFX.
Problems for this application are placed to
data/libmv-ba-problems.

Usage:
  ./libmv_bundle_adjuster --input=/path/to/problem_file.bin

There's also optional flag --refine_intrinsics which
declares explicitly whether intrinscis shall be
refined or not. If this flag is not passed, refinement
will happen for problems stored in image space.

Structure of problem files is described in header
comment of libmv_bundle_adjuster.cc.

Change-Id: I51202848c75dcd7612b707609e5ff3708e01b625
2013-06-01 17:08:31 +00:00