Skip to content

Commit

Permalink
Libmv: Update to the latest upstream version
Browse files Browse the repository at this point in the history
Main reason is to bring up new Glog which should have MSVC 2015
support.
  • Loading branch information
sergeyvfx committed Dec 30, 2015
1 parent 2583cc8 commit 6b7ead4
Show file tree
Hide file tree
Showing 23 changed files with 465 additions and 405 deletions.
186 changes: 82 additions & 104 deletions extern/libmv/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,85 @@
commit d249280fdf7c937fd6ebbc465508843a70aafd4c
Author: Sergey Sharybin <[email protected]>
Date: Wed Dec 30 16:59:28 2015 +0500

Tweaks to Glog to support building on all platforms

This makes it possible to compile Libmv on all platforms,
amount of hacks is lower, which could bring some warnings
up, but those are better be addressed via upstream which
is now rather active.

commit 86c57750ddb857643fb5dd2c83b4953da83dd57d
Author: Sergey Sharybin <[email protected]>
Date: Wed Dec 30 16:15:47 2015 +0500

Enable explicit Schur complement matrix by default

Gives up to 2x speed up of camera solving process in average scene.
In the really huge one it might be slower, but that we need to investigate.

commit d6c52a70b5a0664b7c74bda68f59a895fe8aa235
Author: Sergey Sharybin <[email protected]>
Date: Wed Dec 30 16:13:03 2015 +0500

Fix one frame memory leak when tracking last frame

commit 6e2ac41d25d5923b2a62c96d27d919a36eff9b48
Author: Brecht Van Lommel <[email protected]>
Date: Wed Dec 30 16:11:24 2015 +0500

Motion tracking not workig with Xcode 7 on OS X.

Caused by use of the uninitialized shape_ variable in Resize().

commit fc72ae06fb4ae559ac37d14d1b34d6669505cc86
Author: Sergey Sharybin <[email protected]>
Date: Wed Dec 30 15:56:40 2015 +0500

Update GLog to latest upstream

Should fix issues building with MSVC2015.

commit d4b2d15bd3d195074b074331354de96a1b51042f
Author: Sergey Sharybin <[email protected]>
Date: Wed Dec 30 16:01:10 2015 +0500

Fix wrong README file reference

commit 2b4aa0b7720cae9a408284834559bea9960157ee
Author: Keir Mierle <[email protected]>
Date: Mon May 11 02:16:53 2015 -0700

Make README more informative for GitHub viewers

Reviewers: sergey

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D1295

commit 514e4491aea655d20be047ed87f002fb7854d5c9
Author: Keir Mierle <[email protected]>
Date: Mon May 11 01:54:09 2015 -0700

Simplify the modal solver Ceres cost function

Fix test by flipping the quaternion.

Reviewers: sergey

Reviewed By: sergey

Projects: #libmv

Differential Revision: https://developer.blender.org/D756

commit e55fafd31f7d53d42af7c6b7df2eebe3c2568da9
Author: Sergey Sharybin <[email protected]>
Date: Wed Dec 31 19:05:51 2014 +0500

Synchronize MSVC compilation fixes from Blender

commit 7d6020d2ec42c6cb2749bc891186b4880d26d40b
Author: Sergey Sharybin <[email protected]>
Date: Wed Dec 31 15:32:07 2014 +0500
Expand Down Expand Up @@ -601,107 +683,3 @@ Date: Wed Mar 26 17:44:09 2014 +0600
Fix bad memory write in BA code when having zero-weighted tracks

Issue was really stupid and caused by the wrong vector initialization.

commit d14a372dfe09c7339f267c4904a541fbe2efec43
Author: Sergey Sharybin <[email protected]>
Date: Fri Mar 21 16:02:41 2014 +0600

Attempt to fix compilation error with msvc2013

commit 933531580b4dc4b65601d785cedc16506d615d7b
Author: Sergey Sharybin <[email protected]>
Date: Thu Mar 20 23:07:34 2014 +0600

Compilation fixes for MinGW

Many thanks to Antony Riakiotakis for the patch!

commit f1aefcbf58fe04ea2967434f39f703bb486777c8
Author: Sergey Sharybin <[email protected]>
Date: Thu Feb 27 16:21:19 2014 +0600

Implement separate BA step for tracks which have constant zero weight

This is needed to minimize their reprojection error over the footage.
Without this extra step positions of such tracks were calculated by
algebraic intersection code only, which doesn't give best precision.

commit bcf7f9470b2ea33cf89a31a72037ec03be631637
Author: Sergey Sharybin <[email protected]>
Date: Thu Feb 27 14:16:42 2014 +0600

Avoid zero-sized problem when doing euclidean intersection

Zero-sized problem might occur when intersecting track with
constant zero weight. For such tracks we'll just use result
of algebraic intersection.

TODO: We probably need to have a separate BA step to adjust
positions of tracks with constant zero weight.

commit f884bb20a93189b8210639f3de939c64177d66b3
Author: Sergey Sharybin <[email protected]>
Date: Wed Feb 26 18:00:40 2014 +0600

Ignore zero weighted markers in keyframe selection

It doesn't make sense to use zero-weighted tracks as a correspondences
in keyframe selection.

Such tracks are not guaranteed to be tracked accurately because their
purpose is to add reference points in 3D space without affecting the
solution.

commit 74db5175cdbcabe673b82eef59c88fb7f342c43f
Author: Sergey Sharybin <[email protected]>
Date: Wed Feb 26 13:23:02 2014 +0600

Tweaks to make bundling into Blender warning-less

Mainly issue i caused by conflicts in include directories,
so glog used to include config.h from gflags. It might be
fixed by splitting gflags/glog from Libmv in Blender build
system but that's not something fun to work on. Fixed by
making include directories bit more explicit.

Also solved no-previous-prototype warnings.

commit bc4bc66af0115069562b79e837ccf4fd95c8f97e
Author: Sergey Sharybin <[email protected]>
Date: Fri Feb 21 14:55:13 2014 +0600

Raise epsilon used for model solver test

It was too much small leading to false failure triggering
caused simply by precision issues.

commit bf750590a6af4af3622c01fd1004c44da60484a7
Author: Sergey Sharybin <[email protected]>
Date: Tue Feb 18 23:35:52 2014 +0600

Made it possible to link against Ceres installed on the system

Main purpose of this is to get away from bundled Ceres library
which is not so trivial to re-bundle and takes some to do this
(not talking about CMake options conflicts and pollution).

Enabled by setting WITH_SYSTEM_CERES=ON. Default paths to search
Ceres library:

- /usr/local
- /sw
- /opt/local
- /opt/csw
- /opt/lib/ceres

You might also specify Ceres root directory using CERES_ROOT_DIR
variable (both CMake and environment variables are supported).

If your Ceres is build statically, you're to control all additional
libraries needed to link against using CMAKE_EXE_LINKER_FLAGS.

commit c9156fbf80c86853806844b754b1e48f45c5ec11
Author: Sergey Sharybin <[email protected]>
Date: Tue Feb 18 19:38:22 2014 +0600

Remove .orig file which was added by accident
2 changes: 0 additions & 2 deletions extern/libmv/SConscript
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/python

# NOTE: This file is automatically generated by bundle.sh script
# If you're doing changes in this file, please update template
# in that script too
Expand Down
25 changes: 10 additions & 15 deletions extern/libmv/libmv/multiview/homography.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,8 @@ void GetNormalizedPoints(const Mat &original_points,
class HomographySymmetricGeometricCostFunctor {
public:
HomographySymmetricGeometricCostFunctor(const Vec2 &x,
const Vec2 &y) {
xx_ = x(0);
xy_ = x(1);
yx_ = y(0);
yy_ = y(1);
}
const Vec2 &y)
: x_(x), y_(y) { }

template<typename T>
bool operator()(const T *homography_parameters, T *residuals) const {
Expand All @@ -193,8 +189,8 @@ class HomographySymmetricGeometricCostFunctor {

Mat3 H(homography_parameters);

Vec3 x(T(xx_), T(xy_), T(1.0));
Vec3 y(T(yx_), T(yy_), T(1.0));
Vec3 x(T(x_(0)), T(x_(1)), T(1.0));
Vec3 y(T(y_(0)), T(y_(1)), T(1.0));

Vec3 H_x = H * x;
Vec3 Hinv_y = H.inverse() * y;
Expand All @@ -203,19 +199,18 @@ class HomographySymmetricGeometricCostFunctor {
Hinv_y /= Hinv_y(2);

// This is a forward error.
residuals[0] = H_x(0) - T(yx_);
residuals[1] = H_x(1) - T(yy_);
residuals[0] = H_x(0) - T(y_(0));
residuals[1] = H_x(1) - T(y_(1));

// This is a backward error.
residuals[2] = Hinv_y(0) - T(xx_);
residuals[3] = Hinv_y(1) - T(xy_);
residuals[2] = Hinv_y(0) - T(x_(0));
residuals[3] = Hinv_y(1) - T(x_(1));

return true;
}

// TODO(sergey): Think of better naming.
double xx_, xy_;
double yx_, yy_;
const Vec2 x_;
const Vec2 y_;
};

// Termination checking callback used for homography estimation.
Expand Down
4 changes: 2 additions & 2 deletions extern/libmv/libmv/simple_pipeline/camera_intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class CameraIntrinsics {
double *normalized_x,
double *normalized_y) const = 0;

// Distort an image using the current camera intrinsics
// Distort an image using the current camera instrinsics
//
// The distorted image is computed in output_buffer using samples from
// input_buffer. Both buffers should be width x height x channels sized.
Expand Down Expand Up @@ -226,7 +226,7 @@ class CameraIntrinsics {
int channels,
PixelType *output_buffer);

// Undistort an image using the current camera intrinsics
// Undistort an image using the current camera instrinsics
//
// The undistorted image is computed in output_buffer using samples from
// input_buffer. Both buffers should be width x height x channels sized.
Expand Down
38 changes: 19 additions & 19 deletions extern/libmv/libmv/simple_pipeline/modal_solver.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2012 libmv authors.
// Copyright (c) 2015 libmv authors.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
Expand Down Expand Up @@ -62,32 +62,32 @@ struct ModalReprojectionError {
: observed_x_(observed_x), observed_y_(observed_y),
weight_(weight), bundle_(bundle) { }

// TODO(keir): This should support bundling focal length as well.
template <typename T>
bool operator()(const T* quaternion, // Rotation quaternion
T* residuals) const {
T R[9];
ceres::QuaternionToRotation(quaternion, R);

bool operator()(const T* quaternion, T* residuals) const {
// Convert bundle position from double to T.
T X[3];
X[0] = T(bundle_(0));
X[1] = T(bundle_(1));
X[2] = T(bundle_(2));
T X[3] = { T(bundle_(0)), T(bundle_(1)), T(bundle_(2)) };

// Compute projective coordinates: x = RX.
// Compute the point position in camera coordinates: x = RX.
T x[3];
x[0] = R[0]*X[0] + R[3]*X[1] + R[6]*X[2];
x[1] = R[1]*X[0] + R[4]*X[1] + R[7]*X[2];
x[2] = R[2]*X[0] + R[5]*X[1] + R[8]*X[2];

// Compute normalized coordinates: x /= x[2].
// This flips the sense of the quaternion, to adhere to Blender conventions.
T quaternion_inverse[4] = {
quaternion[0],
-quaternion[1],
-quaternion[2],
-quaternion[3],
};
ceres::QuaternionRotatePoint(quaternion_inverse, X, x);

// Compute normalized coordinates by dividing out the depth.
T xn = x[0] / x[2];
T yn = x[1] / x[2];

// The error is the difference between reprojected
// and observed marker position.
residuals[0] = xn - T(observed_x_);
residuals[1] = yn - T(observed_y_);
// The error is the difference between reprojected and observed marker
// positions, weighted by the passed in weight.
residuals[0] = T(weight_) * (xn - T(observed_x_));
residuals[1] = T(weight_) * (yn - T(observed_y_));

return true;
}
Expand Down
4 changes: 1 addition & 3 deletions extern/libmv/third_party/glog/README.libmv
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
Project: Google Logging
URL: http://code.google.com/p/google-glog/
License: New BSD
Upstream version: 0.3.3, r143
Upstream version: 0.3.4, 4d391fe
Local modifications:
* Added per-platform config.h files so no configuration-time
checks for functions and so are needed.
* See glog_tweaks.patch to see other tweaks which are done
against glog upstream.
4 changes: 3 additions & 1 deletion extern/libmv/third_party/glog/src/base/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@
// *does* cause problems for FreeBSD, or MacOSX, but isn't needed
// for locking there.)
# ifdef __linux__
# define _XOPEN_SOURCE 500 // may be needed to get the rwlock calls
# ifndef _XOPEN_SOURCE // Some other header might have already set it for us.
# define _XOPEN_SOURCE 500 // may be needed to get the rwlock calls
# endif
# endif
# include <pthread.h>
typedef pthread_rwlock_t MutexType;
Expand Down
Loading

0 comments on commit 6b7ead4

Please sign in to comment.