Commit Graph

850 Commits

Author SHA1 Message Date
Sergey Sharybin
4648ec3e82 Remove check for zero focal length in BA cost functor
This check is actually redundant, because empty intrinsics
will have focal length of 1.0, which means original comment
about BundleIntrinsics was not truth.

It is possible that external user will send focal length of
zero to be refined, but blender prevents this from happening.
2013-05-10 06:48:47 +00:00
Sergey Sharybin
3a309a8313 Synchronize changes between bunded libmv and own libmv branch. 2013-05-10 06:26:01 +00:00
Sergey Sharybin
ed131e67c4 Add check for points behind camera in euclidan BA cost functor
In cases keyframes are no so good, algebraic two frames construction
could produce result, for which more aggressive Ceres-based BA code
will fall to a solution for which points goes behind the camera,
which is not so nice.

Seems in newer Ceres returning false from cost functor wouldn't
abort solution, but will restrict solver from moving points behind
the camera.

Works fine in own tests, but requires more tests.
2013-05-09 16:38:58 +00:00
Sergey Sharybin
4f5f97254c Reconstructed scene scale ambiguity improvement
Made it so reconstructed scene always scaled in a way
that variance of camera centers is unity.

This solves "issues" when different keyframes will
give the same reprojection error but will give scenes
with different.scale, which could easily have been
considered as a bad keyframe combination.

This change is essential for automatic keyframe
selection algorithm to work reliable for user.
2013-05-09 16:38:43 +00:00
Sergej Reich
424e8b69f1 bullet: Don't use sse in api for windows.
Remove stray BT_USE_SSE_IN_API definitions.
Was causing problems especially for 32 bit windows.

It's not quite clear why they were added in the first place since
this should be defined in btScalar.h, needs further investigation.

Thanks to Francisco De La Cruz (xercesblue) for looking into this.

Should fix [#35071] Bullet Convex Hull Crashes on Win32 with SSE
2013-05-06 22:53:11 +00:00
Sergej Reich
c80ff61d40 bullet: Fix avoiding collision response between static/kinematic objects
Sent patch upstream.

Fixes [#35115] Character physics type fails collision with static type with an action on 2.67 rc
2013-04-28 21:40:54 +00:00
Sergey Sharybin
d2f61b36f9 Revert 56319, misunderstood API
This was completely skipping BA step when point
goes behind the camera.
2013-04-26 18:25:49 +00:00
Sergey Sharybin
126ca24dbf Fix for BA possible move bundles behind the camera
In some cases (was noticed on not good enough keyframe
pair) bundle adjuster could have moved bundles behind
the camera.

This could indeed lead to lower rewprojection error but
this is just pointless thing to do.

Now added check to residuals functor which will return
false to Ceres in cases point moved behind the camera
to prevent such issues.
2013-04-26 15:43:20 +00:00
Sergey Sharybin
d05f5da111 Update Ceres to current upstream version
This brings a fixes for threading issue in BLAS
making BA step more robust (there were some in-detemrinacy
caused by this threading issue).

Also brings some optimizations, which does not directly
affect on blender.
2013-04-22 09:25:37 +00:00
Sergey Sharybin
79ca1bd004 Make it so FATAL messages from libmv are print to the console
even when --debug-libmv is not passed via command line.
2013-04-15 10:02:33 +00:00
Sergey Sharybin
8cca2fec82 Fix for bundle adjusting with motion restricted
This commit bundles new libmv version from own branch
which brings fix for wrong parameter block used for
modal solver parameterization.

Fixes #34985: Crash with Motion tracker (Tripod Motion)
2013-04-14 23:43:00 +00:00
Sergey Sharybin
d2b55d1171 Bundle adjustment improvements
- Get rid of rotation matrix parameterization,
  use angle-axis instead.

  Also Joined rotation and translation into a
  single parameter block.

  This made minimization go significantly faster,
  like 1.3x times in average.

- Fix first camera when bundling. This is to
  address orientation ambiguity.

  Reconstruction result could still vary in
  size, but that's another issue to be addressed
  later.

Additional change:

Split EuclideanBundleCommonIntrinsics into
smaller functions, so it's now a bit easier
to follow.
2013-04-08 17:05:52 +00:00
Sergey Sharybin
8e8823be12 Update ceres to current upstream version
Brings fixes for BLAS.
2013-04-08 17:05:48 +00:00
Sergey Sharybin
f62d2669de Revert change made to bilinear sampler in libmv
This made preview working but that broke internals
of tracking.

Namely, BlurredImageAndDerivativesChannels is giving
much more blurred image because it was assuming pixel
center is an integer position.

Guess other parts of libmv used to suffer because of
this issue.

Now pixel centering happens in blender side, and
libmv assumes integer position is a pixel center.
2013-04-06 14:47:45 +00:00
Sergey Sharybin
898ba93a12 Update libmv to current upstream version
- Solves some strict compilation warning
- Style/code cleanup
2013-04-05 09:23:20 +00:00
Sergey Sharybin
43b61fb8bd Bundle current master of ceres-solver
Thins brings up some speed improvements:

SPARSE_SCHUR is approx 1.3-1.5x times faster
ITERATIVE_SCHUR is approx 1.2x times faster

For blender this means camera solution go a bit
faster now. Would not have affect on tracking
speed.
2013-04-05 09:22:54 +00:00
Campbell Barton
1777a69818 misc minor edits.
- pass string size to BLI_timestr() to avoid possible buffer overrun.
- quiet warning for mingw.
- include guards for windows utf conversion funcs.
- fix for mistage in edge-angle-selection check.
- some style cleanup.
2013-03-29 06:25:22 +00:00
Sergey Sharybin
729b76eb79 Update ceres to current git version.
Mainly to support msvc2010, bit also includes some minor fixes.
2013-03-21 18:07:03 +00:00
Sergey Sharybin
8a7ce9c924 Fix #34707: Blender crash on enabling of boolean modifier
Stupid mistake by my own with recent Carve update which
undid fix for MSVC STL library.
2013-03-21 08:47:18 +00:00
Campbell Barton
3966722057 code cleanup: misc warnings/style 2013-03-21 02:58:21 +00:00
Sergey Sharybin
6dc4ea34e4 Multi-threaded frame calculation for movie clip proxies
This commit implements multi-threaded calculation of frames
when building proxies. Both scaling and undistortion steps
are now threaded.

Frames and proxy resolution are still handled one-by-one,
saving files after every single step. So if HDD is not so
fast, this commit could have not so much benefit.

Internal changes:

- Added IMB_scaleImBuf_threaded which scales given image
  buffer in multiple threads and uses bilinear filtering.

- libmv's camera intrinsics now have SetThreads() method
  which is used to specify how many OpenMP threads to use
  for buffer distortion/undistortion.

  And yeah, this code is using OpenMP for threading.

- Reshuffled a bit libmv-capi calls and added function
  BKE_tracking_distortion_set_threads to specify number
  of threads used by intrinscis.
2013-03-15 11:59:46 +00:00
Irie Shinsuke
5792e77239 Patch [#34373] Use i18n monospace font in Text editor and Python console
This patch allows Blender to display i18n monospace font in the text
editor and the Python interactive console. Wide characters that occupy
multiple columns such as CJK characters can be displayed correctly.
Furthermore, wrapping, selection, suggestion, cursor drawing, and
syntax highlighting should work.

Also fixes a bug [#34543]: In Text Editor false color in comment on cyrillic

To estimate how many columns each character occupies, this patch uses
wcwidth.c written by Markus Kuhn and distributed under MIT-style license:

  http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c

wcwidth.c is stored in extern/wcwidth and used as a static library.

This patch adds new API to blenfont, blenlib and blenkernel:

BLF_get_unifont_mono()
BLF_free_unifont_mono()
BLF_draw_mono()
BLI_wcwidth()
BLI_wcswidth()
BLI_str_utf8_char_width()
BLI_str_utf8_char_width_safe()
txt_utf8_offset_to_column()
txt_utf8_column_to_offset()
2013-03-12 07:25:53 +00:00
Jens Verwiebe
373de9e936 OSX/gcc-4.6: workaround a compilerbug, use apple-gcc instead 2013-03-07 22:12:23 +00:00
Sergej Reich
643b0be4cb bullet: Update to current svn, r2636
Apply patches in patches directory, remove patches that were applied
upstream.
If you made changes without adding a patch, please check.

Fixes [#32233] exporting bullet format results in corrupt files.
2013-03-07 17:53:16 +00:00
Sergey Sharybin
f81b594790 Switch from DENSE_NORMAL_CHOLESKY to DENSE_QR
DENSE_QR is better behaved numerically and after recent
changes from Sameer there's no big difference in speed.
2013-03-05 09:38:50 +00:00
Sergey Sharybin
3a0d62f4f4 Update Ceres to 1.5RC3
It brings optimization of DENSE_QR and DENSE_SCHUR solvers.
2013-03-05 09:38:43 +00:00
Sergey Sharybin
9da36d3ab1 Updates to libmv's bundle.sh to make sure libmv upstream
is copying properly to our sources.
2013-03-01 11:52:38 +00:00
Sergey Sharybin
1a7ab1da09 Hrm, gcc became broken after recent commit.
Hope now gcc and 32bit msvc would both work.
2013-03-01 08:56:04 +00:00
Sergey Sharybin
a2027237ed Pass data to modal reprojection cost functor by reference
Seems it solves alignment error reported by 32bit MSVC.
2013-03-01 08:20:13 +00:00
Sergey Sharybin
aada0e4a29 Header cleanup in libmv c-api 2013-02-28 14:25:40 +00:00
Sergey Sharybin
d68e766c8c This lines are also not so much useful for now. 2013-02-28 14:25:33 +00:00
Sergey Sharybin
3e320a67e3 Remove unused rigid registration code
There're some features planned which would
require rigid registration, but this code
would need to be re-done anyway to use new
minimizer and solving some issues with ICP
algorithm there.
2013-02-28 14:24:52 +00:00
Sergey Sharybin
52f34f017d Modal (aka tripod) solver rework
Several major things are done in this commit:

- First of all, logic of modal solver was changed.
  We do not rely on only minimizer to take care of
  guessing rotation for frame, but we're using
  analytical rotation computation for point clouds
  to obtain initial rotation.

  Then this rotation is being refined using Ceres
  minimizer and now instead of minimizing average
  distance between points of point of two clouds,
  minimization of reprojection error of point
  cloud onto frame happens.

  This gives quite a bit of precision improvement.

- Second bigger improvement here is using bundle
  adjustment for a result of first step when we're
  only estimating rotation between neighbor images
  and reprojecting markers.

  This averages error across the image sequence
  avoiding error accumulation. Also, this will
  tweak bundles themselves a bit for better match.

- And last bigger improvement here is support of
  camera intrinsics refirenment.

  This allowed to significantly improve solution
  for real-life footage and results after such
  refining are much more usable than it were before.

Thanks to Keir for the help and code review.
2013-02-28 14:24:42 +00:00
Sergey Sharybin
2a5ed5293d Increase verbosity level for reprojected markers info
This information is useful, but in cases when you, say,
working on a bundler it's annoying to scroll all the
information up.

Now behavior would be:
- running `./blender --debug-libmv` will print all the
  debug messages
- running `./blender --debug-libmv --verbose 0` will
  print only debug messages from solvers, recosntruction
  and so, but will bypass final reprojection bunch of
  messages
- running `./blender --debug-lib,v --verbose 1` will
  include final reprojection messages.
2013-02-28 14:24:25 +00:00
Sergey Sharybin
9bfe99281c Move radial distortion code to own templated function
This shall not lead to any functional changes, just
avoids radial distortion code duplicated in camera
intrinsics and bundling code.

For fancier bundle adjustment supprting different
distortion models this is not actually enough and
would need to make some bigger changes, but this
changes makes code a bit easier to maintain already.
2013-02-28 14:24:17 +00:00
Sergey Sharybin
1d20f2496a Use threaded cost function and jacobian computation
Also made it theraded linear solver, seems it makes
sense for iterative schur with inner iterations
enabled.

Use OpenMO's max therads called from bundler code
to detect how many threads to use. Could be changed
in a way that number of threads is passing in options
from blender side in the future.

Also removed redundant V3D definition from compiler's
flags.
2013-02-26 17:52:10 +00:00
Sergey Sharybin
0ec75be1c6 Camera tracking: support refining radial K1, K2 only
This commits adds extra refirenment entry in the menu which is
"K1, K2" and which will apparently refine only this distortion
coefficients.

This would be useful in cases when you know for sure focal length
(which could be obtained from lens, EXIF and so) but not sure
about how good you manual calibration is.

Be careful tho, there're no internal constraints on this
coefficients so distortion model could just screw up into insane
values.
2013-02-26 11:46:38 +00:00
Sergey Sharybin
05a5cbbda2 Camera tracking: switch euclidean intersection code to use Ceres
Would not expect any significant changes in solver behavior, but
it could be more accurate in some cases.

Switching projective intersection to ceres is marked as a TODO
for now.
2013-02-26 11:46:27 +00:00
Sergey Sharybin
b7af3207cc Bye-bye, SSBA!
With new bundle adjustment based on Ceres we don't need
SSBA library anymore. This also means we don't need ldl
library and libmv is no longer depends on colamd as well.
2013-02-25 20:15:42 +00:00
Keir Mierle
2833994a71 Switch motion tracker bundle adjustment to Ceres.
Patch originally written by me, then finished by Sergey. Big
thanks to Sergey for troopering through and fixing the many issues
with my original (not compilable) patch.

The Ceres implementation uses 2 parameter blocks for each camera
(1 for rotation and 1 for translation), 1 parameter block for
common intrinsics (focal length etc) and 1 parameter block for
each track (e.g. bundle or 3D point).

We turn on some fancy optimizer options to get better performance,
in particular:

  options.preconditioner_type = ceres::SCHUR_JACOBI;
  options.linear_solver_type = ceres::ITERATIVE_SCHUR;
  options.use_inner_iterations = true;
  options.use_nonmonotonic_steps = true;
  options.max_num_iterations = 100;

Special thanks to Sameer Agarwal of Ceres fame for splitting out
the SCHUR_JACOBI preconditioner so that it didn't depend on
CHOLMOD.  Previously we could not use that preconditioner in
Blender because CHOLMOD is too large of a dependency for Blender.

BundleIntrinsicsLogMessage:
- Moved bunch of if(foo) LG << "bar" into this function, to make
  EuclideanBundleCommonIntrinsics a little bit easier to follow.

EuclideanBundle:
- Fix RMSE logging.
2013-02-25 20:00:48 +00:00
Sergey Sharybin
18fd4bd9f4 Update Carve to newest upstream version with some assorted fixes
Perhaps some warnings could be silenced, but not in mood of writing
local patches at this moment. They're all harmless anyway.
2013-02-25 10:02:43 +00:00
Sergey Sharybin
ff6ca7dcd0 code cleanup: remove unused and unsupported functions from libmv-capi
---
svn merge -r52855:52856 ^/branches/soc-2011-tomato
2013-02-25 09:38:59 +00:00
Sergey Sharybin
2df945d8ff Camera tracking: libmv distortion API now also uses camera intrinsics
structure instead of passing all the parameters to every function.

Makes it much easier to tweak distortion model.

---
svn merge -r52854:52855 ^/branches/soc-2011-tomato
2013-02-25 09:36:52 +00:00
Sergey Sharybin
a0d646d186 Synchronize libmv with own branch
Should be no functional changes, just would help a lot
checking on which stuff was/shall be merged from tomato
and which is not.
2013-02-25 09:27:57 +00:00
Sergey Sharybin
12baa00b6a code cleanup: camera tracking
- Moved keyframes and refirement flags into reconstruction options structure
- Moved distortion coefficients and other camera intrinsics into own structure
- Cleaned up reconstruction functions in libmv c-api

---
svn merge -r52853:52854 ^/branches/soc-2011-tomato
2013-02-25 09:24:31 +00:00
Sergey Sharybin
66cca267b1 Upgrade Ceres library to current master which is current 1.5RC
This is helpful because it brings CHOLMOB-free ITERATIVE_SCHUR and
SCHUR_JACOBI which is really nice for new upcoming bundle adjustment.

If also includes all the local fixes we made locally.

There're lots of other improvements/fixed which are not currently
would be so much visible in Blender, but which opens doors for some
great improvements in future.
2013-02-25 08:59:26 +00:00
Sergey Sharybin
23d603bdbf Update bundled version of minilzo
This updates minilzo from version 2.03 to version 2.06 which
is like 3 years newer.

The main reason of this update is that older minilzo had some
strange valgrind warnings. Likely they're harmless, but it was
still annoying to troubleshot bakes with valgrind.
2013-02-25 08:16:28 +00:00
Sergey Sharybin
4cf9034f6d Remove extern_ssba workaround
SSBA seemed to be working OK last time i've checked it
with MSVC and optimization enabled.

Also, we'll likely replace it with own BA soon, which
works fine with MSVC anyway.
2013-02-22 10:06:54 +00:00
Sergey Sharybin
ea99b9a392 Made ldl code a part of extern_ssba library, otherwise gcc fails to
find ldl symbols because order of libraries seems to be critical
for gcc linker.

A bit stupid, but that's how linker works..

Both CMake and SCons shall work fine on linux now.
2013-02-20 12:07:27 +00:00
Sergey Sharybin
705d2ab417 Correction to previous release -- scons on linux was broken 2013-02-20 11:41:33 +00:00
Sergey Sharybin
1f88ee6213 Fix #34299: Motion Tracking 20x slower under Windows
Root of the issue goes to SSBA library which didn't work
properly when using optimization in MSVC. It was worked
around by disabling optimization for libmv, which is in
fact shame and shouldn't have been done.

It seems after some changes optimization does not affect
on SSBA code, but enabling optimization could be risky so
close to release.

For now solved by splitting SSBA to separate CMake/SCons
library, disabling optimization only for this particular
library and enabling optimization for rest of libmv.

Tested on all files which used to fail with optimization
enabled in SSBA and all of them works the same as before.
Tracking speed is significantly higher now.

After release we'll enable optimization for SSBA as well,
so there'll be no crappy build setup. Later we'll replace
old SSBA library with new BA code based on Ceres.

Bundle script would be broken for until then, so better
not to use it.
2013-02-20 11:29:43 +00:00
Sergey Sharybin
de23a9bfd5 Correction to previous commit, needed to tweak some include
directories after shuffling order of subdirectories and
compiler flags tweaks.
2013-02-18 11:50:03 +00:00
Sergey Sharybin
971b0f1ed6 Correction to cmake rules for libmv/ceres
libmv still requires optimization switched off because
of some incompatibility of SSBA and MSVC optimizer which
makes bundle adjustment work just wrong.

This shall not be an issue for Ceres and no need to
disable optimization for extern_ceres
2013-02-18 10:45:46 +00:00
Campbell Barton
a78cf854b4 add missing bullet header to cmake, quiet reports from 'make test_cmake' 2013-02-06 04:16:28 +00:00
Sergey Sharybin
25cbd13d22 Workaround for deadlock in face/hole merge function in carve
which could happen in cases of degenerated faces.
2013-02-05 14:27:24 +00:00
Campbell Barton
c2839bfe76 add option WITH_SYSTEM_BULLET to link against the bullet installation found on the system.
Note: this doesn't work yet for everything with latest stable bullet (2.81), need to look into why and likely apply some patches upstream.
However I managed to link blender by disabling some features, likely it can be made to work without too much trouble.
2013-01-03 00:23:52 +00:00
Nicholas Bishop
a8811094ea Import the RangeTree library into extern
RangeTree is a simple C++ tree set for storing non-overlapping scalar
ranges. Original source from:
https://github.com/nicholasbishop/RangeTree

Also update the build systems to include RangeTree.
2012-12-30 18:20:52 +00:00
Sergey Sharybin
0d7e4f3229 Camera tracking: synchronize changes with own branch
Should be no functional changes.
2012-12-20 11:03:39 +00:00
Erwin Coumans
1b37f8dca8 Hi there, it has been a while, just curious if my SVN account still works :)
This commit is an attempt to improve collisions between moving Bullet rigid bodies using (concave) triangle mesh bounds.
Instead of using Gimpact, this we create a btCompoundShape with child shape tetrahedra derived from the surface triangles.
For each triangle, we add a fourth vertex using the centroid, shifting inwards using the triangle normal.
If the centroid hits an internal triangle, we stop. The default depth could be exposed as 'advanced' setting in the user interface.
This solution will be a slower than the original/gimpact solution, but a bit more reliable. 
In the future, it is better to add HACD, convex decomposition to Blender, for moving concave meshes.
See http://kmamou.blogspot.com and the Bullet SDK's Demos/ConvexDecompositionDemo.
2012-12-15 01:01:35 +00:00
Sergey Sharybin
da2dc58773 code cleanup: remove unused and unsupported functions from libmv-capi 2012-12-10 16:38:39 +00:00
Sergey Sharybin
5137b5a146 Camera tracking: libmv distortion API now also uses camera intrinsics structure
instead of passing all the parameters to every function.

Makes it much easier to tweak distortion model.
2012-12-10 16:38:28 +00:00
Sergey Sharybin
ec870eb214 code cleanup: camera tracking
- Moved keyframes and refirement flags into reconstruction options structure
- Moved distortion coefficients and other camera intrinsics into own structure
- Cleaned up reconstruction functions in libmv c-api
2012-12-10 16:38:13 +00:00
Sergey Sharybin
b1afaa8312 Merging r51923 through r52851 from trunk into soc-2011-tomato 2012-12-10 15:18:00 +00:00
Sergey Sharybin
4aeed148d1 Fix for camera solver not working properly when built with scons 2012-12-09 17:42:36 +00:00
Sergey Sharybin
5ba213facd Camera tracking: fixed type in camera intrinsics update function
Seems to be from the very beginning here, not sure why nobody noticed this is wrong.
2012-12-07 13:47:35 +00:00
Campbell Barton
767bfba808 cmake was missing some header files. 2012-12-04 14:43:42 +00:00
Campbell Barton
a7555a81c7 remove unmaintained eltopo, keeping scons/cmake entries, but commenting out user visible config to make branch merging less of a hassle. 2012-11-27 09:52:20 +00:00
Sergey Sharybin
1dd5a89c87 Motion tracking: dump mask image when dump images is enabled
This is pure development option which is enabled by defining DUMP_FAILURE
or DUMP_ALWAYS libmv-capi.
2012-11-20 12:54:28 +00:00
Sergey Sharybin
7245745955 Fix #33192: Opening Blender breaks drag-and-drop support on the KDE desktop
Do not set root window as DND aware.
2012-11-15 20:50:48 +00:00
Jens Verwiebe
acc8c654fc OSX: substitute all MAC_OS_X_VERSION defines with MAC_OS_X_VERSION_MIN_REQUIRED macros, to get more reliable version (api) covering 2012-11-06 15:19:49 +00:00
Sergey Sharybin
da24aa8d10 Merging r51897 through r51922 from trunk into soc-2011-tomato 2012-11-05 19:57:59 +00:00
Sergey Sharybin
18326d852b Merging r50625 through r51896 from trunk into soc-2011-tomato
Merging just in case we'll want to develop some experimental stuff
2012-11-05 19:42:27 +00:00
Sergey Sharybin
c4a422ffbb Fix/workaround for carve aborts on windows
The issue was caused by passing start iterator larger than end iterator
to std::copy in triangulation module. It'll do nothing on linux but will
throw an exception on windows. Now behavior will be identical on both
platforms.

Proper solution would be to figure out why exactly this happened, but it's
easier to be forwarded to Tobias and we'll need to get rid of triangulation
anyway.

This should solve issues:
#30100: boolean intersect crashes blender
#33001: Crash on applying Boolean difference modifier
#33045: Boolean modifier crash with mirrored objects
2012-11-05 11:34:53 +00:00
Sergey Sharybin
3bd7816c75 Camera Tracking: allow fallback to reprojection resection by user demand
This fixes some "regressions" introduced in rev50781 which lead to much
worse solution in some cases. Now it's possible to bring old behavior back.

Perhaps it's more like temporal solution for time being smarter solution is
found. But finding such a solution isn't so fast, so let's bring manual
control over reprojection usage.

But anyway, imo it's now nice to have a structure which could be used to
pass different settings to the solver.
2012-11-05 08:04:27 +00:00
Nicholas Bishop
0b16c9e201 Patch Bullet to make it's convex hull implementation usable in BMesh
* Add access to the original indices for vertices

* Add a very simple C API for convex hull

* Add this patch to the patches folder and update readme.txt
2012-10-23 23:54:02 +00:00
Campbell Barton
bc8f602601 style cleanup 2012-10-20 18:46:57 +00:00
Campbell Barton
536d9fec80 code cleanup:
- move object_iterators.c --> view3d_iterators. (ED_object.h had to include ED_view3d.h which isn't so nice)
- move projection functions from view3d_view.c --> view3d_project.c (view3d_view was becoming a mishmash of utility functions and operators).
- some some cmake includes as system-includes.
2012-10-17 04:13:03 +00:00
Daniel Genrich
827c70abd8 Update to stable Eigen 3.1.1
- Fixes several bugs within the Eigen library:
http://eigen.tuxfamily.org/index.php?title=ChangeLog#Eigen_3.1.1
2012-10-15 16:29:23 +00:00
Campbell Barton
3a947cf537 code cleanup: remove redundant casts 2012-10-14 08:49:01 +00:00
Campbell Barton
dc8340fa33 correct some include dirs not being included as SYSTEM paths in cmake. 2012-10-02 03:18:48 +00:00
Keir Mierle
e38c1a5ae7 Make Euclidean resection "always" succeed.
The Euclidean resection code had a magical constant, 1e-3, used to
compare the results of solving an equation. This failure detection
was well-intended, trying to prevent poor solutions from getting
made without notifying the caller. Unfortunately in practice, this
threshold is too conservative. Furthermore, it is not clear the
threshold should exist at all; the purpose of the Euclidean
resection is to come up with the best solution it can; other
methods (e.g. reprojection error) should be used to compare
whether the method succeeded.

This commit changes the Euclidean EPnP code to always succeed,
causing the previous fallback to projective resection to never
run. In most cases, this will result in better reconstructions.

This should, in most cases, fix the dreaded "flipping" problem.
2012-09-20 18:55:44 +00:00
Keir Mierle
5e433927b5 Fix variable naming in the planar tracker. 2012-09-20 02:27:34 +00:00
Keir Mierle
0af0da957d Add smarter tolerance checking in the planar tracker.
The planar tracker uses Ceres for the refinement stage. During
refinement, Ceres iteratively updates the parameters with the
latest best guess. If the change in the parameters falls below a
threshold, Ceres will abort successfully ("converged").

For the case of pure translation tracking, the parameters are
exactly the two pixel shifts (dx, dy), and measuring the change in
these parameters gives a meaningful termination criterion.
However, for all the other parameterizations like affine, where
the parameterization involves affine parameters that have no
physical interpretation, Ceres is left with no way to terminate
the solver early. With the existing code, often many iterations
are run long after Ceres has found a solution sufficiently
accurate for all tracking needs. No one needs tracking with
a quadrillionth of a pixel accuracy; that time is wasted.

This patch extends the existing iteration callback that is passed
in to Ceres to check if the pattern has fallen out of the search
window, to also check if the optimizer has made a tiny step. In
particular, if the maximum shift of any patch corner between two
successful optimizer steps is less than a threshold (currently
0.005 pixels), the track is declared successful and tracking
is terminated.

This leads to dramatic speed increases in some cases, with little
to no loss in track quality. This is especially apparent when
tracking patches with affine or perspective motion models. For
example, on some tracking cases I tried, the iterations Ceres took
went from 50 to 3.
2012-09-20 02:10:33 +00:00
Keir Mierle
a6f447427b Detect too-small planar tracking patches.
The planar tracker did not detect very skinny patches which have
effectively zero area and are untrackable. This adds detection and
rejection of patterns with zero area. This fixes a crash found by
during Mango production.
2012-09-19 22:25:02 +00:00
Keir Mierle
8a46b8454e Cleanup for when trackers fall out of the search window.
Sergey originally left a TODO() here, but his fix is the correct
one. I removed the TODO and fixed some comment issues.
2012-09-19 22:01:42 +00:00
Sergey Sharybin
16a698ad4a Fix crash when tracking in planar motion model (and maybe some other)
It was an Abort() caused by check for solver result not equal to USER_ABORT.

In some cases solver returns USER_ABORT due to BoundaryCheckingCallback
detects coordinates does not belong to image.

Somehow this callback wasn't called in previous version of Ceres and
in the same case marker was jumping. Now when the callback is called
it seems we could simply return failure of tracking without aborting
Blender.

Probably this is in fact some issue somewhere else, would double
check with Keir about this.
2012-09-19 12:43:39 +00:00
Sergey Sharybin
60e43ebf9c Ceres: resolve no previous declarations warnings
Currently done as patch applied on bundling, would forward it to Ceres developers.
2012-09-18 11:01:51 +00:00
Sergey Sharybin
e37ff1dd46 Libmv: resolved some compilation warnings (missed prototypes)
In some cases it was missed include of header file, in some other
cases symbol could be static.
2012-09-18 10:31:00 +00:00
Sergey Sharybin
c11ca1dc00 Libmv: fixed wrong function prototypes
Also mark non-public functions as static.
2012-09-18 07:09:07 +00:00
Campbell Barton
00c37e1ff6 code cleanup: correct include paths and comment 2012-09-17 04:08:36 +00:00
Sergey Sharybin
eacf3054aa Real fix for OSX CMake -- was a typo in build file generation file
Now Ceres re-bundling should go smooth :)
2012-09-16 14:43:44 +00:00
Jens Verwiebe
de72707b7d Fix OSX compile 2012-09-16 14:31:25 +00:00
Sergey Sharybin
3d84172bc8 Fix typo in one of previous commits 2012-09-16 13:58:15 +00:00
Sergey Sharybin
a4992871d6 Ceres: tweak namespace for hash classes for MSVC2010
Not sure if it'll solve all issues, but at least it should reduce
amount of errors.

Also added missed patch from previous commit.
2012-09-16 12:24:54 +00:00
Sergey Sharybin
02ef4cc33d Ceres: reshuffle include order to solve compilation error with MSVC
Not sure why exactly this happens, would need extra investigation
and should probably be also fixed in upstream.
2012-09-16 12:24:48 +00:00
Sergey Sharybin
bf6ab7a5e2 Libmv: remove unwind hack from CMake rules.
Such stuff better be solved in glog itself.

Should be pretty safe change since it was defined for CMake only
and AFAIR Jens wanted to get rid of this too.
2012-09-16 12:24:43 +00:00
Sergey Sharybin
a737bc49af Ceres: upgrade to version 1.3.0
This should contain real fixes for Windows, making it more robost and hopefully
faster (due to proper collection port) on that platform.

Also hack to fix Eigen alignment shouldn't be needed anymore.

Also on platforms which have got broken TR1 collections it's better to define
CERES_NO_TR1 instead of using Boost hacks. Made changes to Scons and CMake,
but can not check if this indeed works since i don't have OSX here.
2012-09-16 12:24:37 +00:00
Sergey Sharybin
d066ce9533 Ceres: remove debug-only code from bundling script, also move osx workaround to template 2012-09-16 12:23:00 +00:00
Sergey Sharybin
de7a57a242 Merging r50522 through r50572 from trunk into soc-2011-tomato 2012-09-13 11:13:13 +00:00
Brecht Van Lommel
becd442a36 Fix libmv build on OS X with 10.5 SDK. The tr1::unordered_map implementation
is broken in this SDK, now it uses the boost implementation instead.
2012-09-11 11:54:10 +00:00