Commit Graph

12 Commits

Author SHA1 Message Date
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