Camera tracking: switch to own repo of libmv where most of patches are applied
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 17 Feb 2012 15:39:32 +0000 (15:39 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 17 Feb 2012 15:39:32 +0000 (15:39 +0000)
and which includes latest changes from Keir's branch.

Hopefully it'll make backporting of changes back to main libmv repo easier.

22 files changed:
extern/libmv/CMakeLists.txt
extern/libmv/ChangeLog
extern/libmv/bundle.sh
extern/libmv/libmv/base/vector.h
extern/libmv/libmv/simple_pipeline/pipeline.cc
extern/libmv/libmv/simple_pipeline/tracks.h
extern/libmv/libmv/tracking/esm_region_tracker.cc
extern/libmv/libmv/tracking/trklt_region_tracker.h
extern/libmv/patches/bundle_tweaks.patch
extern/libmv/patches/config_mac.patch [deleted file]
extern/libmv/patches/detect.patch [deleted file]
extern/libmv/patches/fast.patch [deleted file]
extern/libmv/patches/function_derivative.patch [deleted file]
extern/libmv/patches/high_distortion_crash_fix.patch [deleted file]
extern/libmv/patches/levenberg_marquardt.patch [deleted file]
extern/libmv/patches/mingw.patch [deleted file]
extern/libmv/patches/msvc2010.patch [deleted file]
extern/libmv/patches/overscan.patch [deleted file]
extern/libmv/patches/scaled_distortion.patch [deleted file]
extern/libmv/patches/series
extern/libmv/patches/snrptinf_fix.patch [deleted file]
extern/libmv/patches/v3d_verbosity.patch

index 075ff15a798971abf9b7646be358b5e107293258..73c2baa020796cfae7dd5da23c6008f9bc2c03ca 100644 (file)
@@ -41,107 +41,107 @@ set(INC_SYS
 
 set(SRC
        libmv-capi.cpp
+       libmv/image/array_nd.cc
+       libmv/image/convolve.cc
+       libmv/multiview/conditioning.cc
+       libmv/multiview/euclidean_resection.cc
+       libmv/multiview/fundamental.cc
+       libmv/multiview/projection.cc
+       libmv/multiview/triangulation.cc
        libmv/numeric/numeric.cc
        libmv/numeric/poly.cc
+       libmv/simple_pipeline/bundle.cc
        libmv/simple_pipeline/callbacks.cc
-       libmv/simple_pipeline/reconstruction.cc
-       libmv/simple_pipeline/resect.cc
-       libmv/simple_pipeline/intersect.cc
-       libmv/simple_pipeline/initialize_reconstruction.cc
        libmv/simple_pipeline/camera_intrinsics.cc
-       libmv/simple_pipeline/pipeline.cc
        libmv/simple_pipeline/detect.cc
+       libmv/simple_pipeline/initialize_reconstruction.cc
+       libmv/simple_pipeline/intersect.cc
+       libmv/simple_pipeline/pipeline.cc
+       libmv/simple_pipeline/reconstruction.cc
+       libmv/simple_pipeline/resect.cc
        libmv/simple_pipeline/tracks.cc
-       libmv/simple_pipeline/bundle.cc
-       libmv/image/convolve.cc
-       libmv/image/array_nd.cc
-       libmv/tracking/pyramid_region_tracker.cc
-       libmv/tracking/sad.cc
        libmv/tracking/brute_region_tracker.cc
-       libmv/tracking/hybrid_region_tracker.cc
        libmv/tracking/esm_region_tracker.cc
-       libmv/tracking/trklt_region_tracker.cc
+       libmv/tracking/hybrid_region_tracker.cc
        libmv/tracking/klt_region_tracker.cc
        libmv/tracking/lmicklt_region_tracker.cc
+       libmv/tracking/pyramid_region_tracker.cc
        libmv/tracking/retrack_region_tracker.cc
-       libmv/multiview/projection.cc
-       libmv/multiview/conditioning.cc
-       libmv/multiview/fundamental.cc
-       libmv/multiview/euclidean_resection.cc
-       libmv/multiview/triangulation.cc
+       libmv/tracking/sad.cc
+       libmv/tracking/trklt_region_tracker.cc
 
-       third_party/ssba/Geometry/v3d_metricbundle.cpp
-       third_party/ssba/Math/v3d_optimization.cpp
-       third_party/gflags/gflags.cc
-       third_party/gflags/gflags_reporting.cc
-       third_party/gflags/gflags_completions.cc
-       third_party/fast/fast_9.c
        third_party/fast/fast_10.c
        third_party/fast/fast_11.c
        third_party/fast/fast_12.c
+       third_party/fast/fast_9.c
        third_party/fast/fast.c
        third_party/fast/nonmax.c
+       third_party/gflags/gflags.cc
+       third_party/gflags/gflags_completions.cc
+       third_party/gflags/gflags_reporting.cc
        third_party/ldl/Source/ldl.c
+       third_party/ssba/Geometry/v3d_metricbundle.cpp
+       third_party/ssba/Math/v3d_optimization.cpp
 
        libmv-capi.h
+       libmv/base/id_generator.h
+       libmv/base/scoped_ptr.h
+       libmv/base/vector.h
+       libmv/base/vector_utils.h
+       libmv/image/array_nd.h
+       libmv/image/convolve.h
+       libmv/image/image.h
+       libmv/image/sample.h
+       libmv/image/tuple.h
        libmv/logging/logging.h
+       libmv/multiview/conditioning.h
+       libmv/multiview/euclidean_resection.h
+       libmv/multiview/fundamental.h
+       libmv/multiview/nviewtriangulation.h
+       libmv/multiview/projection.h
+       libmv/multiview/resection.h
+       libmv/multiview/triangulation.h
        libmv/numeric/dogleg.h
-       libmv/numeric/levenberg_marquardt.h
-       libmv/numeric/poly.h
        libmv/numeric/function_derivative.h
+       libmv/numeric/levenberg_marquardt.h
        libmv/numeric/numeric.h
+       libmv/numeric/poly.h
+       libmv/simple_pipeline/bundle.h
        libmv/simple_pipeline/callbacks.h
-       libmv/simple_pipeline/resect.h
-       libmv/simple_pipeline/reconstruction.h
        libmv/simple_pipeline/camera_intrinsics.h
-       libmv/simple_pipeline/tracks.h
        libmv/simple_pipeline/detect.h
-       libmv/simple_pipeline/pipeline.h
-       libmv/simple_pipeline/intersect.h
-       libmv/simple_pipeline/bundle.h
        libmv/simple_pipeline/initialize_reconstruction.h
-       libmv/image/convolve.h
-       libmv/image/tuple.h
-       libmv/image/array_nd.h
-       libmv/image/sample.h
-       libmv/image/image.h
-       libmv/tracking/region_tracker.h
+       libmv/simple_pipeline/intersect.h
+       libmv/simple_pipeline/pipeline.h
+       libmv/simple_pipeline/reconstruction.h
+       libmv/simple_pipeline/resect.h
+       libmv/simple_pipeline/tracks.h
        libmv/tracking/brute_region_tracker.h
+       libmv/tracking/esm_region_tracker.h
        libmv/tracking/hybrid_region_tracker.h
+       libmv/tracking/klt_region_tracker.h
+       libmv/tracking/lmicklt_region_tracker.h
+       libmv/tracking/pyramid_region_tracker.h
+       libmv/tracking/region_tracker.h
        libmv/tracking/retrack_region_tracker.h
        libmv/tracking/sad.h
-       libmv/tracking/pyramid_region_tracker.h
-       libmv/tracking/esm_region_tracker.h
        libmv/tracking/trklt_region_tracker.h
-       libmv/tracking/klt_region_tracker.h
-       libmv/tracking/lmicklt_region_tracker.h
-       libmv/base/id_generator.h
-       libmv/base/vector.h
-       libmv/base/scoped_ptr.h
-       libmv/base/vector_utils.h
-       libmv/multiview/nviewtriangulation.h
-       libmv/multiview/resection.h
-       libmv/multiview/euclidean_resection.h
-       libmv/multiview/triangulation.h
-       libmv/multiview/projection.h
-       libmv/multiview/fundamental.h
-       libmv/multiview/conditioning.h
 
-       third_party/ssba/Geometry/v3d_metricbundle.h
-       third_party/ssba/Geometry/v3d_cameramatrix.h
-       third_party/ssba/Geometry/v3d_distortion.h
-       third_party/ssba/Math/v3d_linear_utils.h
-       third_party/ssba/Math/v3d_optimization.h
-       third_party/ssba/Math/v3d_mathutilities.h
-       third_party/ssba/Math/v3d_linear.h
-       third_party/gflags/gflags_completions.h
-       third_party/gflags/mutex.h
+       third_party/fast/fast.h
        third_party/gflags/config.h
+       third_party/gflags/gflags_completions.h
        third_party/gflags/gflags.h
-       third_party/fast/fast.h
+       third_party/gflags/mutex.h
        third_party/ldl/Include/ldl.h
-       third_party/msinttypes/stdint.h
        third_party/msinttypes/inttypes.h
+       third_party/msinttypes/stdint.h
+       third_party/ssba/Geometry/v3d_cameramatrix.h
+       third_party/ssba/Geometry/v3d_distortion.h
+       third_party/ssba/Geometry/v3d_metricbundle.h
+       third_party/ssba/Math/v3d_linear.h
+       third_party/ssba/Math/v3d_linear_utils.h
+       third_party/ssba/Math/v3d_mathutilities.h
+       third_party/ssba/Math/v3d_optimization.h
 )
 
 if(WIN32)
@@ -152,23 +152,23 @@ if(WIN32)
                third_party/glog/src/vlog_is_on.cc
                third_party/glog/src/windows/port.cc
 
-               third_party/glog/src/config.h
-               third_party/glog/src/stacktrace.h
+               third_party/glog/src/utilities.h
                third_party/glog/src/stacktrace_generic-inl.h
-               third_party/glog/src/stacktrace_libunwind-inl.h
-               third_party/glog/src/stacktrace_powerpc-inl.h
-               third_party/glog/src/stacktrace_x86-inl.h
+               third_party/glog/src/stacktrace.h
                third_party/glog/src/stacktrace_x86_64-inl.h
-               third_party/glog/src/utilities.h
-               third_party/glog/src/base/commandlineflags.h
                third_party/glog/src/base/googleinit.h
                third_party/glog/src/base/mutex.h
-               third_party/glog/src/windows/config.h
-               third_party/glog/src/windows/port.h
-               third_party/glog/src/windows/glog/log_severity.h
-               third_party/glog/src/windows/glog/logging.h
+               third_party/glog/src/base/commandlineflags.h
+               third_party/glog/src/stacktrace_powerpc-inl.h
+               third_party/glog/src/stacktrace_x86-inl.h
+               third_party/glog/src/config.h
+               third_party/glog/src/stacktrace_libunwind-inl.h
                third_party/glog/src/windows/glog/raw_logging.h
                third_party/glog/src/windows/glog/vlog_is_on.h
+               third_party/glog/src/windows/glog/logging.h
+               third_party/glog/src/windows/glog/log_severity.h
+               third_party/glog/src/windows/port.h
+               third_party/glog/src/windows/config.h
        )
 
        list(APPEND INC
@@ -190,34 +190,34 @@ if(WIN32)
        endif()
 else()
        list(APPEND SRC
-               third_party/glog/src/utilities.cc
-               third_party/glog/src/symbolize.cc
-               third_party/glog/src/vlog_is_on.cc
-               third_party/glog/src/signalhandler.cc
-               third_party/glog/src/logging.cc
                third_party/glog/src/demangle.cc
+               third_party/glog/src/logging.cc
                third_party/glog/src/raw_logging.cc
+               third_party/glog/src/signalhandler.cc
+               third_party/glog/src/symbolize.cc
+               third_party/glog/src/utilities.cc
+               third_party/glog/src/vlog_is_on.cc
 
-               third_party/glog/src/config.h
+               third_party/glog/src/base/commandlineflags.h
+               third_party/glog/src/base/googleinit.h
+               third_party/glog/src/base/mutex.h
                third_party/glog/src/config_freebsd.h
+               third_party/glog/src/config.h
                third_party/glog/src/config_linux.h
                third_party/glog/src/config_mac.h
                third_party/glog/src/demangle.h
-               third_party/glog/src/stacktrace.h
+               third_party/glog/src/glog/logging.h
+               third_party/glog/src/glog/log_severity.h
+               third_party/glog/src/glog/raw_logging.h
+               third_party/glog/src/glog/vlog_is_on.h
                third_party/glog/src/stacktrace_generic-inl.h
+               third_party/glog/src/stacktrace.h
                third_party/glog/src/stacktrace_libunwind-inl.h
                third_party/glog/src/stacktrace_powerpc-inl.h
-               third_party/glog/src/stacktrace_x86-inl.h
                third_party/glog/src/stacktrace_x86_64-inl.h
+               third_party/glog/src/stacktrace_x86-inl.h
                third_party/glog/src/symbolize.h
                third_party/glog/src/utilities.h
-               third_party/glog/src/base/commandlineflags.h
-               third_party/glog/src/base/googleinit.h
-               third_party/glog/src/base/mutex.h
-               third_party/glog/src/glog/log_severity.h
-               third_party/glog/src/glog/logging.h
-               third_party/glog/src/glog/raw_logging.h
-               third_party/glog/src/glog/vlog_is_on.h
        )
 
        list(APPEND INC
index 7e10abfead61f014856ed601a1f284ac7a98c5ab..522ae5cd80908538878db97ab05419c23b466bf4 100644 (file)
@@ -1,3 +1,345 @@
+commit f8c2b223f01551fd81a85f6d5221646165147035
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 21:32:05 2012 +0600
+
+    Picky edits: corrected EOL
+
+commit 3f2a4205ec5adadcdfa306b161c705c868a7be93
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 21:30:07 2012 +0600
+
+    Fixed incorrect access to ucontext on linux. Caused by incorrect merge conflict resolve.
+
+commit d360a21a5aa125cf9e83dd26b302508688ff7007
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 20:54:13 2012 +0600
+
+    More Windows -> Unix EOL conversions
+
+commit 18aeda58bec9556140ba617724e31ada6f5b67c0
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 20:15:42 2012 +0600
+
+    Looks like this debug output was removed accidentally.
+
+commit 189dc0cacdee3c1eab68c43263ecb038ed244c09
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 20:11:56 2012 +0600
+
+    Made V3D verbose again by default
+
+commit 8b3422d3eec5e450d76243886bf07fb0a3e83a81
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 20:08:01 2012 +0600
+
+    SAD tracker now can deal with pattern size any size,
+    Very quick implementation came from Blender before Hybrid tracker was added.
+    Better to be replaced with brute tracker.
+
+commit d547c9cfe37d5d3397d33c8b0e58471e1e1c1634
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 20:03:52 2012 +0600
+
+    Just convert end of lines to unix style.
+
+commit eb73ddbaec5b9e1ad30331bbf858a6ebc266c4aa
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 20:02:20 2012 +0600
+
+    Made some function static. Resolves possible linking issues when building with MinGW.
+
+commit 2930681fafd86e4f4a958054b1db8bfff29623d1
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 19:59:45 2012 +0600
+
+    Missed this in commit with improvements in camera intrinsics.
+
+commit 8d31bc767019b05c5bf8c9f309f9545b3428afa1
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 19:57:51 2012 +0600
+
+    Another step of syncing codebase with Blender.
+    Mainly fixes for freebsd/osx compilation and aligned memory allocation.
+
+commit 3214a2df5bfd98021f25d0f1a626a86318bb245f
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 19:48:02 2012 +0600
+
+    Support compilation on FreeBSD platform
+
+commit 0e5abe96f543687ccfb3a923ec639cb8f45d54f8
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 19:44:18 2012 +0600
+
+    Implementation of basic system for progress reporting into callee stuff
+    
+    Implemented by using simple callbacks classes which are getting invoked from
+    places where lots of calculation happens, so applications which are using
+    libmv may display nice progress bar.
+
+commit c5e18fe35464618055e0e9761be8d22fae56db49
+Author: Keir Mierle <mierle@gmail.com>
+Date:   Fri Feb 17 19:25:45 2012 +0600
+
+    Add support for detecting tracking failure in the ESM tracker component of
+    libmv. Since both KLT and Hybrid rely on ESM underneath, KLT and Hybrid now
+    have a minimum correlation setting to match. With this fix, track failures
+    should get detected quicker, with the issue that sometimes the tracker will
+    give up too easily. That is fixable by reducing the required correlation (in
+    the track properties).
+
+commit ea0fed736ecdcc8c020227aeef8ef4cd3be5e63d
+Author: Keir Mierle <mierle@gmail.com>
+Date:   Fri Feb 17 19:23:50 2012 +0600
+
+    Add a new hybrid region tracker for motion tracking to libmv, and
+    add it as an option (under "Hybrid") in the tracking settings. The
+    region tracker is a combination of brute force tracking for coarse
+    alignment, then refinement with the ESM/KLT algorithm already in
+    libmv that gives excellent subpixel precision (typically 1/50'th
+    of a pixel)
+    
+    This also adds a new "brute force" region tracker which does a
+    brute force search through every pixel position in the destination
+    for the pattern in the first frame. It leverages SSE if available,
+    similar to the SAD tracker, to do this quickly. Currently it does
+    some unnecessary conversions to/from floating point that will get
+    fixed later.
+    
+    The hybrid tracker glues the two trackers (brute & ESM) together
+    to get an overall better tracker. The algorithm is simple:
+    
+    1. Track from frame 1 to frame 2 with the brute force tracker.
+        This tries every possible pixel position for the pattern from
+        frame 1 in frame 2. The position with the smallest
+        sum-of-absolute-differences is chosen. By definition, this
+        position is only accurate up to 1 pixel or so.
+    2. Using the result from 1, initialize a track with ESM. This does
+        a least-squares fit with subpixel precision.
+    3. If the ESM shift was more than 2 pixels, report failure.
+    4. If the ESM track shifted less than 2 pixels, then the track is
+        good and we're done. The rationale here is that if the
+        refinement stage shifts more than 1 pixel, then the brute force
+        result likely found some random position that's not a good fit.
+
+commit a07fff8431621c01d81ae52595d8dd91a295a776
+Author: Keir Mierle <mierle@gmail.com>
+Date:   Fri Feb 17 19:19:58 2012 +0600
+
+    Assorted camera tracker improvements
+    
+    - Add support for refining the camera's intrinsic parameters
+      during a solve. Currently, refining supports only the following
+      combinations of intrinsic parameters:
+    
+        f
+        f, cx, cy
+        f, cx, cy, k1, k2
+        f, k1
+        f, k1, k2
+    
+      This is not the same as autocalibration, since the user must
+      still make a reasonable initial guess about the focal length and
+      other parameters, whereas true autocalibration would eliminate
+      the need for the user specify intrinsic parameters at all.
+    
+      However, the solver works well with only rough guesses for the
+      focal length, so perhaps full autocalibation is not that
+      important.
+    
+      Adding support for the last two combinations, (f, k1) and (f,
+      k1, k2) required changes to the library libmv depends on for
+      bundle adjustment, SSBA. These changes should get ported
+      upstream not just to libmv but to SSBA as well.
+    
+    - Improved the region of convergence for bundle adjustment by
+      increasing the number of Levenberg-Marquardt iterations from 50
+      to 500. This way, the solver is able to crawl out of the bad
+      local minima it gets stuck in when changing from, for example,
+      bundling k1 and k2 to just k1 and resetting k2 to 0.
+    
+    - Add several new region tracker implementations. A region tracker
+      is a libmv concept, which refers to tracking a template image
+      pattern through frames. The impact to end users is that tracking
+      should "just work better". I am reserving a more detailed
+      writeup, and maybe a paper, for later.
+    
+    - Other libmv tweaks, such as detecting that a tracker is headed
+      outside of the image bounds.
+    
+    This includes several changes made directly to the libmv extern
+    code rather expecting to get those changes through normal libmv
+    channels, because I, the libmv BDFL, decided it was faster to work
+    on libmv directly in Blender, then later reverse-port the libmv
+    changes from Blender back into libmv trunk. The interesting part
+    is that I added a full Levenberg-Marquardt loop to the region
+    tracking code, which should lead to a more stable solutions. I
+    also added a hacky implementation of "Efficient Second-Order
+    Minimization" for tracking, which works nicely. A more detailed
+    quantitative evaluation will follow.
+
+commit 0bf66c009d5022eacfc473d247884a73ffeefa8f
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 19:13:49 2012 +0600
+
+    Rest of compilation fix with FAST library.
+
+commit 71b578ca2ba34c528363c514cd1fcc85791d01f3
+Author: Keir Mierle <mierle@gmail.com>
+Date:   Fri Feb 17 19:00:28 2012 +0600
+
+    Improve the KLT tracking behaviour and UI
+    
+    - Remove the overly-conservative use of libmv's re-track tracker. The re-track
+      tracker would take a normal tracker such as TRKLT or KLT or pyramid KLT, and
+      track from frame 1 to 2, then back from the position found in 2 back to 1.
+      Then, when the reverse-track doesn't match the original track with high
+      precision, the track is considered "failed". This is a good approach for
+      fully automatic reconstruction, but is too conservative for supervised
+      tracking.
+    
+      The retrack-tracker will return when fully automatic tracking is added.
+    
+    - Always solve for (dx, dy) in the TRKLT loop even if the linear system is
+      ill-conditioned. The client (Blender in this case) can still use the solved
+      position, even though it is less reliable.
+
+commit 7d8a8762f2bc2e36f95b0b6f4fb4ca996f9f0db7
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 18:46:24 2012 +0600
+
+    Changes in camera intrinsics distortion/undistortion:
+    
+    - Distortion/undistortion of scaled images wasn't happening right,
+      because camera intrinsics are calibrated on an original frame which
+      has got some particular resolution and trying to apply this model on
+      an image with another resolution gives totally wrong result.
+      This is needed to be able to do post-prccessing of render, running
+      distortion on a scene which might be rendered with higher resolution
+      than footage itself and then be scaled down.
+    - Fixed incorrect calculation/applying of precomputed grid when
+      distortion is high high enough and produces pixel offset higher
+      than 127 pixels. This might be still not very distorted image,
+      but if it's a 4K footage "normal" camera will easily give such
+      a distortion.
+    - Added support of overscan distortion/undistortion.
+
+commit ed080785d63bb8e3a13dde51a2dc94fe59b059bb
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 18:38:51 2012 +0600
+
+    Fast headers now can be included from C++ sources.
+    Was needed to make it working fine when bundling in Blender but might also
+    be needed to bundle into another applications.
+
+commit 5f5a7aa46a2d87b96c8098dfc8682f4d01b5cd40
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 18:36:16 2012 +0600
+
+    Bring back FAST detector which seems to be working much nicer than Morravec.
+    Both of them are available in API.
+
+commit 2cab13c18216fb684b270cec077f7300262584af
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 18:27:36 2012 +0600
+
+    Revert "Make CameraIntrinsics (and thus Qt tracker) compilable without linking libmv."
+    
+    This reverts commit 81613ee0cc94b315f333c9632b18b95d426aad05.
+    
+    That commit made inverting intrinsics totally unworkable, so reverted this and
+    made needed tweaks to qt-tracker project file to make it compilable (was needed
+    to make it linking together with glog).
+    
+    Conflicts:
+    
+       src/ui/tracker/tracker.cc
+       src/ui/tracker/tracker.pro
+
+commit ec46cae041401b17afb4fe4d9c9343d10797090f
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 17:59:55 2012 +0600
+
+    Fix compilation error using official MinGW
+
+commit 6fbc370e922c47cfa35381662b6c439f4891ed74
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 17:38:20 2012 +0600
+
+    Fix compilation error with MSVC 2010 which is more picky for "missed" STL headers
+
+commit be9e6b63691d83b551a085f0766878bd84220767
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 17:36:18 2012 +0600
+
+    Fix compilation with MSVC where snprintf function is declared as unsafe and _snprintf should be used instead.
+    
+    Better to switch to own implementation will ensure string is correctly NULL-terminated.
+
+commit 1847d9e414ed763cd80668775d7d9f79575fc8ca
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 17:34:45 2012 +0600
+
+    Fix compilation error on OSX caused by incorrect access to ucontext
+
+commit 90579b6ffad07672172a1c240499615b30b25549
+Merge: b9aac30 531c79b
+Author: Sergey Sharybin <sergey.vfx@gmail.com>
+Date:   Fri Feb 17 18:32:52 2012 +0600
+
+    Merge remote-tracking branch 'Matthias-Fauconneau/master' into devel
+    
+    Conflicts:
+       src/libmv/tracking/CMakeLists.txt
+
+commit b9aac30a9ca6bc8362c09a0e191040964f7c6de2
+Merge: 198894e 6969e1a
+Author: Keir Mierle <mierle@gmail.com>
+Date:   Sat Nov 5 17:38:30 2011 -0700
+
+    Merge pull request #3 from nathanwiegand/master
+    
+    Just a few tiny cleanups
+
+commit 6969e1a9534291a982749baa5a3672c97bfa506d
+Author: Nathan Wiegand <nathanwiegand@gmail.com>
+Date:   Sat Nov 5 14:26:54 2011 -0700
+
+    I've added cleaned up a few style issues here an there. Also, I've updated the CMakeLists.txt file so that it can build the image_io library. Note, it's only been tested on OSX 10.6
+
+commit 4763f851299050140757bfaa069107a0cf639e56
+Author: Nathan Wiegand <nathanwiegand@gmail.com>
+Date:   Fri Nov 4 23:59:08 2011 -0700
+
+    Removed a superfulous comment
+
+commit a44577c0162e273681e4a9a3cc5f5b37d4315b67
+Author: Nathan Wiegand <nathanwiegand@gmail.com>
+Date:   Fri Nov 4 23:55:52 2011 -0700
+
+    Removed a duplicate entry for an author.
+
+commit 198894e4c4f51c2c1784ad7c02eb45d2d1ada9bc
+Merge: c4c67db 6e797d6
+Author: Keir Mierle <mierle@gmail.com>
+Date:   Fri Nov 4 21:47:05 2011 -0700
+
+    Merge pull request #2 from nathanwiegand/master
+    
+    CMake changes for OSX
+
+commit 6e797d678c4c19f6a9e21657d66183f412cc995b
+Author: Nathan Wiegand <nathanwiegand@gmail.com>
+Date:   Fri Nov 4 21:43:28 2011 -0700
+
+    Uncomment the GUI part of the CMake file
+
+commit 33ef88a33860345d8906f3c9dd22d8dbce3df53e
+Author: Nathan Wiegand <nathanwiegand@gmail.com>
+Date:   Fri Nov 4 21:31:22 2011 -0700
+
+    Fixed build error on OSX by adding 'glog' to the dependencies in the tracker CMake
+
 commit 531c79bf95fddaaa70707d1abcd4fdafda16bbf0
 Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
 Date:   Sat Aug 20 00:00:42 2011 +0200
@@ -103,210 +445,3 @@ Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
 Date:   Thu Aug 18 16:18:44 2011 +0200
 
     UI and API support for affine tracking.
-
-commit a4876d8c40dcde615b44009c38c49e9a1b1d4698
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Wed Aug 17 20:26:01 2011 +0200
-
-    Hack to make sad.cc compile with MSVC on system without support for the SSE instruction set.
-
-commit 0de723dfce5bbe44dbd19be8cd6dd6e9b03b7924
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Wed Aug 17 20:10:46 2011 +0200
-
-    Fix slow path (for computers without SSE2).
-    Heap allocate scores in detect.cc
-
-commit 65a9d496f81e8b37eae39a4063957b8be9a4e6f0
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Wed Aug 17 19:25:17 2011 +0200
-
-    Fix compilation on OSX.
-
-commit d22720e618456329388d2c107422c3b371657cba
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Wed Aug 17 14:14:45 2011 +0200
-
-    Improve Detect and SAD Tracker API and documentation.
-
-commit 5d6cd4ad365b061901bad40695b51d568487a0cf
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Wed Aug 17 11:57:29 2011 +0200
-
-    MSVC support fixes.
-
-commit 50f0323173c6deebd6aaf9c126f0b51b2a79c3c1
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 16 23:21:37 2011 +0200
-
-    Detector can detect features similar to a given pattern.
-
-commit 5734cc27bbf84c2b6edcfcc1ea736798e12d5820
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 16 22:53:54 2011 +0200
-
-    Ensure SAD Tracker is C compatible.
-    Update Detect API documentation.
-
-commit 701c42842574064fea992f8822e3899cb9066108
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 16 21:56:42 2011 +0200
-
-    Remove FAST detector.
-    Add Moravec detector.
-    This detector is more suited to tracking since it try to choose patterns which are unlikely to drift by computing SAD with neighbouring patches.
-    It could be improved to better avoid edges.
-
-commit 9bdf93e13fc880c78b6f34397da673388c16040e
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 16 21:55:08 2011 +0200
-
-    Fix Qt Tracker GL to work with AMD drivers.
-
-commit 81613ee0cc94b315f333c9632b18b95d426aad05
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 16 21:54:12 2011 +0200
-
-    Make CameraIntrinsics (and thus Qt tracker) compilable without linking libmv.
-
-commit a1d9a8fa8b01ef7cf2a79b3b891633fc333fc9cf
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 16 21:24:51 2011 +0200
-
-    Fix SAD tracker. Pattern was transposed by affine pattern sampler.
-
-commit c3b794da2e7fd23f2fbdf90dbd71de0e6b3bc811
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 16 21:19:02 2011 +0200
-
-    Fix SAD tracker. Pattern was transposed by affine pattern sampler.
-
-commit a9b61bf3356f27174cdd983f562f99c3a6a2cc35
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Sun Aug 14 09:56:51 2011 +0200
-
-    Clarify CameraIntrinsics documentation.
-    Edit CameraInstrinsics test to fail.
-
-commit 10bdad9ad2cea2603896263cde5a5339169a9af0
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Fri Aug 12 21:05:32 2011 +0200
-
-    Fix out of bound access in warp bilinear sampling.
-
-commit dd9a418db021a28af2c1198d5e5b9e68fe048a03
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Fri Aug 12 19:14:36 2011 +0200
-
-    Fix compilation with -funsigned-char.
-
-commit bd1a268ede39b67f2ba4b360f6fc693419e7cd7f
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Fri Aug 12 18:39:27 2011 +0200
-
-    CameraIntrinsics fixes.
-
-commit ae513b39fb779632f96ceff7c1e014fb8e68702a
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 9 19:38:58 2011 +0200
-
-    Remove stray QDebug include.
-
-commit 1e58f55078ce6009a885be30ae0316aec6ed8239
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 9 14:16:31 2011 +0200
-
-    Make API future-proof (for an eventual affine or planar tracker).
-
-commit c2af303e7bf0dddcb02937323ac5846b1801e6cc
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 9 11:13:29 2011 +0200
-
-    Remove reconstruction breaking debug code.
-
-commit 8792a633e5c5f1c1f12e164b9e8897ca0790ac59
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 9 10:49:18 2011 +0200
-
-    Remove getchar()s.
-
-commit 63a9bdee0cbd1197e0315d01c27bfc2361bd5656
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 9 10:35:07 2011 +0200
-
-    Adapt patch to new PipelineRoutines code generation strategy.
-
-commit 096ff1a4070f7212c50fb0a4b2feec7ca9d97158
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 9 09:54:12 2011 +0200
-
-    Merge max_image and max_track fix from tomato.
-
-commit d8450cd3c37278a397482cd36b1e2419f154cfb9
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Tue Aug 9 09:38:49 2011 +0200
-
-    Synchronize tree with Tomato: Merge patch for better resection, keep deprecated KLT tracker.
-
-commit e9b2dca920cf9575c15150a4988634b00e343a41
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Mon Aug 8 17:07:08 2011 +0200
-
-    Fixes, Documentation.
-
-commit 4fc1c57a2d92442808ac4a3676e6d9a25a51e310
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Sun Aug 7 14:35:08 2011 +0200
-
-    Improve tracker resilience by penalizing large motion vectors.
-
-commit cc8e7e8e08cd91f75c080a0091461ca9fe969664
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Sun Aug 7 09:28:09 2011 +0200
-
-    Leverage SSE2 SAD instruction for 16x speed improvement in integer pixel search resulting in ~1ms per marker for 16x16 pattern on 128x128 region.
-
-commit f362ab4999a768370fca57552464b459eb9fbddc
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Sun Aug 7 09:06:04 2011 +0200
-
-    Improve SAD Tracker subpixel precision (avoid drift even when adapting at each frame).
-
-commit fce7a214c561b5f5f0e17115c31fb48814bde2db
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Sat Aug 6 21:57:06 2011 +0200
-
-    Track using simple Sum of Absolute Differences matching.
-    This method is simpler, more robust, faster and accurate.
-
-commit 620a7a35d9a2818bf6e9dbf5d11debda4be6bc26
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Fri Jul 29 12:35:57 2011 +0200
-
-    Add Intersect unit test.
-
-commit a2bf58fa57be11215eb17ff7f7de58f97d480ec3
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Thu Jul 28 11:08:06 2011 +0200
-
-    Remove tests depending on dead code.
-    Fix CameraIntrinsics test.
-    Add Intersect and Resect tests.
-
-commit 19bddee10b4879c8cd2238ccdf5b8f7620cf8384
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Wed Jul 27 12:07:21 2011 +0200
-
-    Image Distortion: Fixes and more testing.
-
-commit 0454d97da328fb0eda8c6c50511ac31864a6d3d6
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Wed Jul 27 10:32:37 2011 +0200
-
-    Test float image distortion.
-
-commit 8db01595a8721f766d85931a8d92b780461d8741
-Author: Matthias Fauconneau <matthias.fauconneau@gmail.com>
-Date:   Wed Jul 27 10:27:07 2011 +0200
-
-    Image Distortion: Bilinear sampling, Optimization, Instantiate all variants (Distort/Undistort, float/ubyte, 1-4 channels).
index f5cfcc0d4886910f78ffe76bb51cbb97fbe2b12e..f259635035e27e0dc1c3f9547913320756cc92f1 100755 (executable)
@@ -1,7 +1,8 @@
 #!/bin/sh
 
 #BRANCH="keir"
-BRANCH="Matthias-Fauconneau"
+#BRANCH="Matthias-Fauconneau"
+BRANCH="Nazg-Gul"
 
 if [ -d ./.svn ]; then
   echo "This script is supposed to work only when using git-svn"
@@ -24,7 +25,7 @@ done
 rm -rf libmv
 rm -rf third_party
 
-cat "files.txt" | while f=`line`; do
+cat "files.txt" | while read f; do
   mkdir -p `dirname $f`
   cp $tmp/libmv/src/$f $f
 done
@@ -36,14 +37,14 @@ chmod 664 ./third_party/glog/src/windows/*.cc ./third_party/glog/src/windows/*.h
 sources=`find ./libmv -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t/' | sort -d`
 headers=`find ./libmv -type f -iname '*.h' | sed -r 's/^\.\//\t/' | sort -d`
 
-third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v glog | sed -r 's/^\.\//\t/' | sort`
-third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | sed -r 's/^\.\//\t/' | sort`
+third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v glog | sed -r 's/^\.\//\t/' | sort -d`
+third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | sed -r 's/^\.\//\t/' | sort -d`
 
-third_glog_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort`
-third_glog_headers=`find ./third_party -type f -iname '*.h' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort`
+third_glog_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort -d`
+third_glog_headers=`find ./third_party -type f -iname '*.h' | grep glog | grep -v windows | sed -r 's/^\.\//\t\t/' | sort -d`
 
-src_dir=`find ./libmv -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/' | sort | uniq`
-src_third_dir=`find ./third_party -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/'  | sort | uniq`
+src_dir=`find ./libmv -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/' | sort -d | uniq`
+src_third_dir=`find ./third_party -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | sed -r 's/^\.\//\t/'  | sort -d | uniq`
 src=""
 win_src=""
 for x in $src_dir $src_third_dir; do
@@ -103,7 +104,7 @@ cat > CMakeLists.txt << EOF
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 # The Original Code is Copyright (C) 2011, Blender Foundation
 # All rights reserved.
index 9dc48676629c741d61a61f0596d978b6001b9be6..c2a3298087afe6efce7249ca02bd87f4da2dbb2c 100644 (file)
@@ -84,6 +84,8 @@ class vector {
         T& front()                 { return data_[0];         }
   const T& operator[](int n) const { return data_[n];         }
         T& operator[](int n)       { return data_[n];         }
+  const T& at(int n)         const { return data_[n];         }
+        T& at(int n)               { return data_[n];         }
   const T * begin()          const { return data_;            }
   const T * end()            const { return data_+size_;      }
         T * begin()                { return data_;            }
index 382365e579f379b9bb46bad646ae1ce63c38a5c8..2e4e5a6491dcc5fd43efd968dd7898c59a5c8f2b 100644 (file)
@@ -279,25 +279,7 @@ double InternalReprojectionError(const Tracks &image_tracks,
         PipelineRoutines::ProjectMarker(*point, *camera, intrinsics);
     double ex = reprojected_marker.x - markers[i].x;
     double ey = reprojected_marker.y - markers[i].y;
-#if 0
-    const int N = 100;
-    char line[N];
-    snprintf(line, N,
-           "image %-3d track %-3d "
-           "x %7.1f y %7.1f "
-           "rx %7.1f ry %7.1f "
-           "ex %7.1f ey %7.1f"
-           "    e %7.1f",
-           markers[i].image,
-           markers[i].track,
-           markers[i].x,
-           markers[i].y,
-           reprojected_marker.x,
-           reprojected_marker.y,
-           ex,
-           ey,
-           sqrt(ex*ex + ey*ey));
-#endif
+
     total_error += sqrt(ex*ex + ey*ey);
   }
   LG << "Skipped " << num_skipped << " markers.";
index 739c3c4f24302586d572e53d357881d1d0e217d2..aa0fbaa6e4ccebd237acb583b369288d3f55934d 100644 (file)
@@ -27,13 +27,13 @@ namespace libmv {
 
 /*!
     A Marker is the 2D location of a tracked point in an image.
-  
+
     \a x, \a y is the position of the marker in pixels from the top left corner
     in the image identified by \a image. All markers for to the same target
     form a track identified by a common \a track number.
-  
+
     \note Markers are typically aggregated with the help of the \l Tracks class.
-  
+
     \sa Tracks
 */
 struct Marker {
@@ -44,18 +44,18 @@ struct Marker {
 
 /*!
     The Tracks class stores \link Marker reconstruction markers \endlink.
-    
+
     The Tracks container is intended as the store of correspondences between
     images, which must get created before any 3D reconstruction can take place.
-    
+
     The container has several fast lookups for queries typically needed for
     structure from motion algorithms, such as \l MarkersForTracksInBothImages().
-    
+
     \sa Marker
 */
 class Tracks {
  public:
-  Tracks() {}
+  Tracks() { }
 
   // Copy constructor for a tracks object.
   Tracks(const Tracks &other);
@@ -67,10 +67,10 @@ class Tracks {
       Inserts a marker into the set. If there is already a marker for the given
       \a image and \a track, the existing marker is replaced. If there is no
       marker for the given \a image and \a track, a new one is added.
-    
+
       \a image and \a track are the keys used to retrieve the markers with the
       other methods in this class.
-    
+
       \note To get an identifier for a new track, use \l MaxTrack() + 1.
   */
   void Insert(int image, int track, double x, double y);
@@ -86,7 +86,7 @@ class Tracks {
 
   /*!
       Returns the markers in \a image1 and \a image2 which have a common track.
-      
+
       This is not the same as the union of the markers in \a image1 and \a
       image2; each marker is for a track that appears in both images.
   */
index 9784b61c0684fb615a4c8650cc6b171865029583..5ee3950bd710ab90d7b8d31f343b565a58b9201f 100644 (file)
@@ -18,8 +18,6 @@
 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 // IN THE SOFTWARE.
 
-#define _USE_MATH_DEFINES
-
 #include "libmv/tracking/esm_region_tracker.h"
 
 #include "libmv/logging/logging.h"
index 5046e0f069da719b189e28d93a999fb33e6a96b0..26d0621aa023d364fd499121f8668c1a2a44c1d1 100644 (file)
@@ -42,7 +42,7 @@ struct TrkltRegionTracker : public RegionTracker {
         min_update_squared_distance(1e-6),
         sigma(0.9),
         lambda(0.05) {}
-  
+
   virtual ~TrkltRegionTracker() {}
 
   // Tracker interface.
index f7b06b0a2dd9e115221625b3d60a39d3f7e6d88b..aebc257f7f928010cbf3fa124144f04b25fa6876 100644 (file)
@@ -11,6 +11,36 @@ index 067da52..af86c4b 100644
  
  #define LG LOG(INFO)
  #define V0 LOG(INFO)
+diff --git a/src/libmv/simple_pipeline/pipeline.cc b/src/libmv/simple_pipeline/pipeline.cc
+index 2459d05..2e4e5a6 100644
+--- a/src/libmv/simple_pipeline/pipeline.cc
++++ b/src/libmv/simple_pipeline/pipeline.cc
+@@ -280,25 +280,6 @@ double InternalReprojectionError(const Tracks &image_tracks,
+     double ex = reprojected_marker.x - markers[i].x;
+     double ey = reprojected_marker.y - markers[i].y;
+-    const int N = 100;
+-    char line[N];
+-    snprintf(line, N,
+-           "image %-3d track %-3d "
+-           "x %7.1f y %7.1f "
+-           "rx %7.1f ry %7.1f "
+-           "ex %7.1f ey %7.1f"
+-           "    e %7.1f",
+-           markers[i].image,
+-           markers[i].track,
+-           markers[i].x,
+-           markers[i].y,
+-           reprojected_marker.x,
+-           reprojected_marker.y,
+-           ex,
+-           ey,
+-           sqrt(ex*ex + ey*ey));
+-    LG << line;
+-
+     total_error += sqrt(ex*ex + ey*ey);
+   }
+   LG << "Skipped " << num_skipped << " markers.";
 diff --git a/src/third_party/glog/src/glog/logging.h b/src/third_party/glog/src/glog/logging.h
 index 57615ef..a58d478 100644
 --- a/src/third_party/glog/src/glog/logging.h
@@ -65,7 +95,7 @@ index 50c6a71..b179a1e 100644
  
  #ifdef HAVE_STACKTRACE
 diff --git a/src/third_party/glog/src/utilities.h b/src/third_party/glog/src/utilities.h
-index ee54f94..2d4e99e 100644
+index c4ae256..5c841a0 100644
 --- a/src/third_party/glog/src/utilities.h
 +++ b/src/third_party/glog/src/utilities.h
 @@ -79,7 +79,7 @@
@@ -106,7 +136,7 @@ index 114762e..682a1b9 100755
  /* define if you have libunwind */
  #undef HAVE_LIB_UNWIND
 diff --git a/src/third_party/glog/src/windows/glog/logging.h b/src/third_party/glog/src/windows/glog/logging.h
-index 7a6df74..de51586 100755
+index 4257375..2f41681 100755
 --- a/src/third_party/glog/src/windows/glog/logging.h
 +++ b/src/third_party/glog/src/windows/glog/logging.h
 @@ -82,8 +82,8 @@
@@ -119,4 +149,4 @@ index 7a6df74..de51586 100755
 +#include "third_party/gflags/gflags.h"
  #endif
  
- namespace google {
+ #ifdef __MINGW32__
diff --git a/extern/libmv/patches/config_mac.patch b/extern/libmv/patches/config_mac.patch
deleted file mode 100644 (file)
index 5a88015..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/src/third_party/glog/src/config_mac.h b/src/third_party/glog/src/config_mac.h
-index a45575b..5f953d1 100644
---- a/src/third_party/glog/src/config_mac.h
-+++ b/src/third_party/glog/src/config_mac.h
-@@ -131,7 +131,7 @@
- #define PACKAGE_VERSION "0.3.1"
- /* How to access the PC from a struct ucontext */
--#define PC_FROM_UCONTEXT uc_mcontext->__ss.__rip
-+#undef PC_FROM_UCONTEXT
- /* Define to necessary symbol if this constant uses a non-standard name on
-    your system. */
diff --git a/extern/libmv/patches/detect.patch b/extern/libmv/patches/detect.patch
deleted file mode 100644 (file)
index 36fea84..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-diff --git a/src/libmv/simple_pipeline/detect.cc b/src/libmv/simple_pipeline/detect.cc
-index 6fc0cdd..8ac42ab 100644
---- a/src/libmv/simple_pipeline/detect.cc
-+++ b/src/libmv/simple_pipeline/detect.cc
-@@ -23,15 +23,89 @@
- ****************************************************************************/
- #include "libmv/simple_pipeline/detect.h"
-+#include <third_party/fast/fast.h>
- #include <stdlib.h>
--#include <string.h>
-+#include <memory.h>
-+
-+#ifdef __SSE2__
-+#include <emmintrin.h>
-+#endif
- namespace libmv {
- typedef unsigned int uint;
-+int featurecmp(const void *a_v, const void *b_v)
-+{
-+  Feature *a = (Feature*)a_v;
-+  Feature *b = (Feature*)b_v;
-+
-+  return b->score - a->score;
-+}
-+
-+std::vector<Feature> DetectFAST(const unsigned char* data, int width, int height, int stride,
-+                           int min_trackness, int min_distance) {
-+  std::vector<Feature> features;
-+  // TODO(MatthiasF): Support targetting a feature count (binary search trackness)
-+  int num_features;
-+  xy* all = fast9_detect(data, width, height,
-+                         stride, min_trackness, &num_features);
-+  if(num_features == 0) {
-+    free(all);
-+    return features;
-+  }
-+  int* scores = fast9_score(data, stride, all, num_features, min_trackness);
-+  // TODO: merge with close feature suppression
-+  xy* nonmax = nonmax_suppression(all, scores, num_features, &num_features);
-+  free(all);
-+  // Remove too close features
-+  // TODO(MatthiasF): A resolution independent parameter would be better than distance
-+  // e.g. a coefficient going from 0 (no minimal distance) to 1 (optimal circle packing)
-+  // FIXME(MatthiasF): this method will not necessarily give all maximum markers
-+  if(num_features) {
-+    Feature *all_features = new Feature[num_features];
-+
-+    for(int i = 0; i < num_features; ++i) {
-+      Feature a = { nonmax[i].x, nonmax[i].y, scores[i], 0 };
-+      all_features[i] = a;
-+    }
-+
-+    qsort((void *)all_features, num_features, sizeof(Feature), featurecmp);
-+
-+    features.reserve(num_features);
-+
-+    int prev_score = all_features[0].score;
-+    for(int i = 0; i < num_features; ++i) {
-+      bool ok = true;
-+      Feature a = all_features[i];
-+      if(a.score>prev_score)
-+        abort();
-+      prev_score = a.score;
-+
-+      // compare each feature against filtered set
-+      for(int j = 0; j < features.size(); j++) {
-+        Feature& b = features[j];
-+        if ( (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y) < min_distance*min_distance ) {
-+          // already a nearby feature
-+          ok = false;
-+          break;
-+        }
-+      }
-+
-+      if(ok) {
-+        // add the new feature
-+        features.push_back(a);
-+      }
-+    }
-+
-+    delete [] all_features;
-+  }
-+  free(scores);
-+  free(nonmax);
-+  return features;
-+}
-+
- #ifdef __SSE2__
--#include <emmintrin.h>
- static uint SAD(const ubyte* imageA, const ubyte* imageB, int strideA, int strideB) {
-   __m128i a = _mm_setzero_si128();
-   for(int i = 0; i < 16; i++) {
-@@ -52,7 +126,7 @@ static uint SAD(const ubyte* imageA, const ubyte* imageB, int strideA, int strid
- }
- #endif
--void Detect(ubyte* image, int stride, int width, int height, Feature* detected, int* count, int distance, ubyte* pattern) {
-+void DetectMORAVEC(ubyte* image, int stride, int width, int height, Feature* detected, int* count, int distance, ubyte* pattern) {
-   unsigned short histogram[256];
-   memset(histogram,0,sizeof(histogram));
-   ubyte* scores = new ubyte[width*height];
-diff --git a/src/libmv/simple_pipeline/detect.h b/src/libmv/simple_pipeline/detect.h
-index 23b239b..bbe7aed 100644
---- a/src/libmv/simple_pipeline/detect.h
-+++ b/src/libmv/simple_pipeline/detect.h
-@@ -25,27 +25,52 @@
- #ifndef LIBMV_SIMPLE_PIPELINE_DETECT_H_
- #define LIBMV_SIMPLE_PIPELINE_DETECT_H_
--#ifdef __cplusplus
-+#include <vector>
-+
- namespace libmv {
--#endif
- typedef unsigned char ubyte;
- /*!
--    \a Feature is the 2D location of a detected feature in an image.
-+    A Feature is the 2D location of a detected feature in an image.
--    \a x, \a y is the position of the center in pixels (from image top-left).
--    \a score is an estimate of how well the pattern will be tracked.
--    \a size can be used as an initial size to track the pattern.
-+    \a x, \a y is the position of the feature in pixels from the top left corner.
-+    \a score is an estimate of how well the feature will be tracked.
-+    \a size can be used as an initial pattern size to track the feature.
-     \sa Detect
- */
- struct Feature {
-+  /// Position in pixels (from top-left corner)
-+  /// \note libmv might eventually support subpixel precision.
-   float x, y;
-+  /// Trackness of the feature
-   float score;
-+  /// Size of the feature in pixels
-   float size;
- };
-- //radius for non maximal suppression
-+
-+/*!
-+    Detect features in an image.
-+
-+    You need to input a single channel 8-bit image using pointer to image \a data,
-+    \a width, \a height and \a stride (i.e bytes per line).
-+
-+    You can tweak the count of detected features using \a min_trackness, which is
-+    the minimum score to add a feature, and \a min_distance which is the minimal
-+    distance accepted between two featuress.
-+
-+    \note You can binary search over \a min_trackness to get a given feature count.
-+
-+    \note a way to get an uniform distribution of a given feature count is:
-+          \a min_distance = \a width * \a height / desired_feature_count ^ 2
-+
-+    \return All detected feartures matching given parameters
-+*/
-+std::vector<Feature> DetectFAST(const unsigned char* data, int width, int height,
-+                           int stride, int min_trackness = 128,
-+                           int min_distance = 120);
-+
- /*!
-     Detect features in an image.
-@@ -63,10 +88,8 @@ struct Feature {
-     \note \a You can crop the image (to avoid detecting markers near the borders) without copying:
-              image += marginY*stride+marginX, width -= 2*marginX, height -= 2*marginY;
- */
--void Detect(ubyte* image, int stride, int width, int height, Feature* detected, int* count, int distance /*=32*/, ubyte* pattern /*=0*/);
-+void DetectMORAVEC(ubyte* image, int stride, int width, int height, Feature* detected, int* count, int distance /*=32*/, ubyte* pattern /*=0*/);
--#ifdef __cplusplus
- }
--#endif
- #endif
diff --git a/extern/libmv/patches/fast.patch b/extern/libmv/patches/fast.patch
deleted file mode 100644 (file)
index 8e0aeb7..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-diff --git a/src/third_party/fast/fast.h b/src/third_party/fast/fast.h
-index 2b3825a..06fa90e 100644
---- a/src/third_party/fast/fast.h
-+++ b/src/third_party/fast/fast.h
-@@ -1,6 +1,10 @@
- #ifndef FAST_H
- #define FAST_H
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
- typedef struct { int x, y; } xy; 
- typedef unsigned char byte;
-@@ -28,4 +32,8 @@ xy* fast12_detect_nonmax(const byte* im, int xsize, int ysize, int stride, int b
- xy* nonmax_suppression(const xy* corners, const int* scores, int num_corners, int* ret_num_nonmax);
-+#ifdef __cplusplus
-+}
-+#endif
-+
- #endif
diff --git a/extern/libmv/patches/function_derivative.patch b/extern/libmv/patches/function_derivative.patch
deleted file mode 100644 (file)
index be7ccfc..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-diff --git a/src/libmv/numeric/function_derivative.h b/src/libmv/numeric/function_derivative.h
-index 0075d23..d7bc437 100644
---- a/src/libmv/numeric/function_derivative.h
-+++ b/src/libmv/numeric/function_derivative.h
-@@ -24,6 +24,7 @@
- #include <cmath>
- #include "libmv/numeric/numeric.h"
-+#include "libmv/logging/logging.h"
- namespace libmv {
-@@ -97,7 +98,7 @@ bool CheckJacobian(const Function &f, const typename Function::XMatrixType &x) {
-   typename NumericJacobian<Function>::JMatrixType J_numeric = j_numeric(x);
-   typename NumericJacobian<Function>::JMatrixType J_analytic = j_analytic(x);
--  //LG << J_numeric - J_analytic;
-+  LG << J_numeric - J_analytic;
-   return true;
- }
diff --git a/extern/libmv/patches/high_distortion_crash_fix.patch b/extern/libmv/patches/high_distortion_crash_fix.patch
deleted file mode 100644 (file)
index 54ab66f..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-diff --git a/src/libmv/simple_pipeline/camera_intrinsics.cc b/src/libmv/simple_pipeline/camera_intrinsics.cc
-index 4e88e1f..f9888ff 100644
---- a/src/libmv/simple_pipeline/camera_intrinsics.cc
-+++ b/src/libmv/simple_pipeline/camera_intrinsics.cc
-@@ -160,9 +160,13 @@ void CameraIntrinsics::ComputeLookupGrid(Offset* grid, int width, int height) {
-       if( iy < 0 ) { iy = 0, fy = 0; }
-       if( ix >= width-2 ) ix = width-2;
-       if( iy >= height-2 ) iy = height-2;
--      //assert( ix-x > -128 && ix-x < 128 && iy-y > -128 && iy-y < 128 );
--      Offset offset = { ix-x, iy-y, fx, fy };
--      grid[y*width+x] = offset;
-+      if ( ix-x > -128 && ix-x < 128 && iy-y > -128 && iy-y < 128 ) {
-+        Offset offset = { ix-x, iy-y, fx, fy };
-+        grid[y*width+x] = offset;
-+      } else {
-+        Offset offset = { 0, 0, 0, 0 };
-+        grid[y*width+x] = offset;
-+      }
-     }
-   }
- }
diff --git a/extern/libmv/patches/levenberg_marquardt.patch b/extern/libmv/patches/levenberg_marquardt.patch
deleted file mode 100644 (file)
index 49ef82d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-diff --git a/src/libmv/numeric/levenberg_marquardt.h b/src/libmv/numeric/levenberg_marquardt.h
-index 6a54f66..4473b72 100644
---- a/src/libmv/numeric/levenberg_marquardt.h
-+++ b/src/libmv/numeric/levenberg_marquardt.h
-@@ -33,6 +33,7 @@
- #include "libmv/numeric/numeric.h"
- #include "libmv/numeric/function_derivative.h"
-+#include "libmv/logging/logging.h"
- namespace libmv {
-@@ -123,26 +124,40 @@ class LevenbergMarquardt {
-     Parameters dx, x_new;
-     int i;
-     for (i = 0; results.status == RUNNING && i < params.max_iterations; ++i) {
--      if (dx.norm() <= params.relative_step_threshold * x.norm()) {
-+      VLOG(1) << "iteration: " << i;
-+      VLOG(1) << "||f(x)||: " << f_(x).norm();
-+      VLOG(1) << "max(g): " << g.array().abs().maxCoeff();
-+      VLOG(1) << "u: " << u;
-+      VLOG(1) << "v: " << v;
-+
-+      AMatrixType A_augmented = A + u*AMatrixType::Identity(J.cols(), J.cols());
-+      Solver solver(A_augmented);
-+      dx = solver.solve(g);
-+      bool solved = (A_augmented * dx).isApprox(g);
-+      if (!solved) {
-+        LOG(ERROR) << "Failed to solve";
-+      }
-+      if (solved && dx.norm() <= params.relative_step_threshold * x.norm()) {
-         results.status = RELATIVE_STEP_SIZE_TOO_SMALL;
-         break;
--      }
--      x_new = x + dx;
--      // Rho is the ratio of the actual reduction in error to the reduction
--      // in error that would be obtained if the problem was linear.
--      // See [1] for details.
--      Scalar rho((error.squaredNorm() - f_(x_new).squaredNorm())
--                 / dx.dot(u*dx + g));
--      if (rho > 0) {
--        // Accept the Gauss-Newton step because the linear model fits well.
--        x = x_new;
--        results.status = Update(x, params, &J, &A, &error, &g);
--        Scalar tmp = Scalar(2*rho-1);
--        u = u*std::max(1/3., 1 - (tmp*tmp*tmp));
--        v = 2;
--        continue;
--      }
--
-+      } 
-+      if (solved) {
-+        x_new = x + dx;
-+        // Rho is the ratio of the actual reduction in error to the reduction
-+        // in error that would be obtained if the problem was linear.
-+        // See [1] for details.
-+        Scalar rho((error.squaredNorm() - f_(x_new).squaredNorm())
-+                   / dx.dot(u*dx + g));
-+        if (rho > 0) {
-+          // Accept the Gauss-Newton step because the linear model fits well.
-+          x = x_new;
-+          results.status = Update(x, params, &J, &A, &error, &g);
-+          Scalar tmp = Scalar(2*rho-1);
-+          u = u*std::max(1/3., 1 - (tmp*tmp*tmp));
-+          v = 2;
-+          continue;
-+        } 
-+      } 
-       // Reject the update because either the normal equations failed to solve
-       // or the local linear model was not good (rho < 0). Instead, increase u
-       // to move closer to gradient descent.
diff --git a/extern/libmv/patches/mingw.patch b/extern/libmv/patches/mingw.patch
deleted file mode 100644 (file)
index 029e7d7..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-diff --git a/src/libmv/multiview/euclidean_resection.cc b/src/libmv/multiview/euclidean_resection.cc
-index 6d918a1..9286251 100644
---- a/src/libmv/multiview/euclidean_resection.cc
-+++ b/src/libmv/multiview/euclidean_resection.cc
-@@ -32,6 +32,8 @@
- namespace libmv {
- namespace euclidean_resection {
-+typedef unsigned int uint;
-+
- bool EuclideanResection(const Mat2X &x_camera, 
-                         const Mat3X &X_world,
-                         Mat3 *R, Vec3 *t,
-diff --git a/src/libmv/numeric/numeric.h b/src/libmv/numeric/numeric.h
-index f39d126..21e0f06 100644
---- a/src/libmv/numeric/numeric.h
-+++ b/src/libmv/numeric/numeric.h
-@@ -40,7 +40,7 @@
-   }
- #endif //_WIN32 || __APPLE__
--#if _WIN32
-+#if (defined(WIN32) || defined(WIN64)) && !defined(__MINGW32__)
-   inline long lround(double d) {
-     return (long)(d>0 ? d+0.5 : ceil(d-0.5));
-   }
-diff --git a/src/third_party/glog/src/config.h b/src/third_party/glog/src/config.h
-index ed8d56e..06ed686 100644
---- a/src/third_party/glog/src/config.h
-+++ b/src/third_party/glog/src/config.h
-@@ -4,6 +4,8 @@
- /* Namespace for Google classes */
- #ifdef __APPLE__
-  #include "config_mac.h"
-+#elif __MINGW32__
-+ #include "windows/config.h"
- #elif __GNUC__
-  #include "config_linux.h"
- #elif _MSC_VER
-diff --git a/src/third_party/glog/src/utilities.h b/src/third_party/glog/src/utilities.h
-index ee54f94..c4ae256 100644
---- a/src/third_party/glog/src/utilities.h
-+++ b/src/third_party/glog/src/utilities.h
-@@ -101,7 +101,9 @@
- // correctly when GetStackTrace() is called with max_depth == 0.
- // Some code may do that.
--#if defined(HAVE_LIB_UNWIND)
-+#if __MINGW32__
-+# undef STACKTRACE_H
-+#elif defined(HAVE_LIB_UNWIND)
- # define STACKTRACE_H "stacktrace_libunwind-inl.h"
- #elif !defined(NO_FRAME_POINTER)
- # if defined(__i386__) && __GNUC__ >= 2
-diff --git a/src/third_party/glog/src/windows/glog/logging.h b/src/third_party/glog/src/windows/glog/logging.h
-index 7a6df74..4257375 100755
---- a/src/third_party/glog/src/windows/glog/logging.h
-+++ b/src/third_party/glog/src/windows/glog/logging.h
-@@ -59,7 +59,7 @@
- // Annoying stuff for windows -- makes sure clients can import these functions
- #ifndef GOOGLE_GLOG_DLL_DECL
--# if defined(_WIN32) && !defined(__CYGWIN__)
-+# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
- #   define GOOGLE_GLOG_DLL_DECL  __declspec(dllimport)
- # else
- #   define GOOGLE_GLOG_DLL_DECL
-@@ -86,6 +86,15 @@
- #include <gflags/gflags.h>
- #endif
-+#ifdef __MINGW32__
-+#  include <stdlib.h>
-+#  include <unistd.h>
-+#  include <stdint.h>             // the normal place uint16_t is defined
-+#  include <sys/types.h>          // the normal place u_int16_t is defined
-+#  include <inttypes.h>           // a third place for uint16_t or u_int16_t
-+#  define _exit(x) exit(x)
-+#endif
-+
- namespace google {
- #if 0      // the C99 format
-@@ -98,11 +107,16 @@ typedef int32_t int32;
- typedef u_int32_t uint32;
- typedef int64_t int64;
- typedef u_int64_t uint64;
--#elif 1    // the windows (vc7) format
-+#elif defined(_MSC_VER)
- typedef __int32 int32;
- typedef unsigned __int32 uint32;
- typedef __int64 int64;
- typedef unsigned __int64 uint64;
-+#elif defined(__MINGW32__)
-+typedef int32_t int32;
-+typedef uint32_t uint32;
-+typedef int64_t int64;
-+typedef uint64_t uint64;
- #else
- #error Do not know how to define a 32-bit integer quantity on your system
- #endif
-diff --git a/src/third_party/glog/src/windows/port.h b/src/third_party/glog/src/windows/port.h
-index d093bf5..d507812 100755
---- a/src/third_party/glog/src/windows/port.h
-+++ b/src/third_party/glog/src/windows/port.h
-@@ -59,14 +59,16 @@
-  * used by both C and C++ code, so we put all the C++ together.
-  */
--/* 4244: otherwise we get problems when substracting two size_t's to an int
-- * 4251: it's complaining about a private struct I've chosen not to dllexport
-- * 4355: we use this in a constructor, but we do it safely
-- * 4715: for some reason VC++ stopped realizing you can't return after abort()
-- * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
-- * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
-- */
--#pragma warning(disable:4244 4251 4355 4715 4800 4996)
-+#if _MSC_VER
-+ /* 4244: otherwise we get problems when substracting two size_t's to an int
-+  * 4251: it's complaining about a private struct I've chosen not to dllexport
-+  * 4355: we use this in a constructor, but we do it safely
-+  * 4715: for some reason VC++ stopped realizing you can't return after abort()
-+  * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
-+  * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
-+  */
-+# pragma warning(disable:4244 4251 4355 4715 4800 4996)
-+#endif
- /* file I/O */
- #define PATH_MAX 1024
-@@ -108,7 +110,9 @@ extern int snprintf(char *str, size_t size,
- extern int safe_vsnprintf(char *str, size_t size,
-                           const char *format, va_list ap);
- #define vsnprintf(str, size, format, ap)  safe_vsnprintf(str, size, format, ap)
-+#if !defined(__MINGW32__)
- #define va_copy(dst, src)  (dst) = (src)
-+#endif
- /* Windows doesn't support specifying the number of buckets as a
-  * hash_map constructor arg, so we leave this blank.
-@@ -130,13 +134,30 @@ enum { PTHREAD_ONCE_INIT = 0 };   // important that this be 0! for SpinLock
- #define pthread_equal(pthread_t_1, pthread_t_2)  ((pthread_t_1)==(pthread_t_2))
- inline struct tm* localtime_r(const time_t* timep, struct tm* result) {
-+#if __MINGW32__
-+   struct tm *local_result;
-+   local_result = localtime (timep);
-+
-+   if (local_result == NULL || result == NULL)
-+     return NULL;
-+
-+   memcpy (result, local_result, sizeof (result));
-+
-+   return result;
-+#else
-   localtime_s(result, timep);
-   return result;
-+#endif
- }
- inline char* strerror_r(int errnum, char* buf, size_t buflen) {
-+#if __MINGW32__
-+  strncpy(buf, "Not implemented yet", buflen);
-+  return buf;
-+#else
-   strerror_s(buf, buflen, errnum);
-   return buf;
-+#endif
- }
- #ifndef __cplusplus
diff --git a/extern/libmv/patches/msvc2010.patch b/extern/libmv/patches/msvc2010.patch
deleted file mode 100644 (file)
index c090b07..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-diff --git a/src/libmv/simple_pipeline/tracks.cc b/src/libmv/simple_pipeline/tracks.cc
-index 0e2a1b6..3fb8ddb 100644
---- a/src/libmv/simple_pipeline/tracks.cc
-+++ b/src/libmv/simple_pipeline/tracks.cc
-@@ -20,6 +20,7 @@
- #include <algorithm>
- #include <vector>
-+#include <iterator>
- #include "libmv/numeric/numeric.h"
- #include "libmv/simple_pipeline/tracks.h"
diff --git a/extern/libmv/patches/overscan.patch b/extern/libmv/patches/overscan.patch
deleted file mode 100644 (file)
index c68f368..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-diff --git a/src/libmv/simple_pipeline/camera_intrinsics.cc b/src/libmv/simple_pipeline/camera_intrinsics.cc
-index 110a16d..366129d 100644
---- a/src/libmv/simple_pipeline/camera_intrinsics.cc
-+++ b/src/libmv/simple_pipeline/camera_intrinsics.cc
-@@ -31,6 +31,7 @@ struct Offset {
- struct Grid {
-   struct Offset *offset;
-   int width, height;
-+  double overscan;
- };
- static struct Grid *copyGrid(struct Grid *from)
-@@ -42,6 +43,7 @@ static struct Grid *copyGrid(struct Grid *from)
-     to->width = from->width;
-     to->height = from->height;
-+    to->overscan = from->overscan;
-     to->offset = new Offset[to->width*to->height];
-     memcpy(to->offset, from->offset, sizeof(struct Offset)*to->width*to->height);
-@@ -184,17 +186,19 @@ void CameraIntrinsics::InvertIntrinsics(double image_x,
- // TODO(MatthiasF): downsample lookup
- template<typename WarpFunction>
--void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height) {
--  double aspx = (double)width / image_width_;
--  double aspy = (double)height / image_height_;
-+void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height, double overscan) {
-+  double w = (double)width / (1 + overscan);
-+  double h = (double)height / (1 + overscan);
-+  double aspx = (double)w / image_width_;
-+  double aspy = (double)h / image_height_;
-   for (int y = 0; y < height; y++) {
-     for (int x = 0; x < width; x++) {
--      double src_x = x / aspx, src_y = y / aspy;
-+      double src_x = (x - 0.5 * overscan * w) / aspx, src_y = (y - 0.5 * overscan * h) / aspy;
-       double warp_x, warp_y;
-       WarpFunction(this,src_x,src_y,&warp_x,&warp_y);
--      warp_x = warp_x*aspx;
--      warp_y = warp_y*aspy;
-+      warp_x = warp_x*aspx + 0.5 * overscan * w;
-+      warp_y = warp_y*aspy + 0.5 * overscan * h;
-       int ix = int(warp_x), iy = int(warp_y);
-       int fx = round((warp_x-ix)*256), fy = round((warp_y-iy)*256);
-       if(fx == 256) { fx=0; ix++; }
-@@ -264,10 +268,10 @@ struct InvertIntrinsicsFunction {
-   }
- };
--void CameraIntrinsics::CheckDistortLookupGrid(int width, int height)
-+void CameraIntrinsics::CheckDistortLookupGrid(int width, int height, double overscan)
- {
-   if(distort_) {
--    if(distort_->width != width || distort_->height != height) {
-+    if(distort_->width != width || distort_->height != height || distort_->overscan != overscan) {
-       delete [] distort_->offset;
-       distort_->offset = NULL;
-     }
-@@ -278,17 +282,18 @@ void CameraIntrinsics::CheckDistortLookupGrid(int width, int height)
-   if(!distort_->offset) {
-       distort_->offset = new Offset[width*height];
--      ComputeLookupGrid<InvertIntrinsicsFunction>(distort_,width,height);
-+      ComputeLookupGrid<InvertIntrinsicsFunction>(distort_,width,height,overscan);
-   }
-   distort_->width = width;
-   distort_->height = height;
-+  distort_->overscan = overscan;
- }
--void CameraIntrinsics::CheckUndistortLookupGrid(int width, int height)
-+void CameraIntrinsics::CheckUndistortLookupGrid(int width, int height, double overscan)
- {
-   if(undistort_) {
--    if(undistort_->width != width || undistort_->height != height) {
-+    if(undistort_->width != width || undistort_->height != height || undistort_->overscan != overscan) {
-       delete [] undistort_->offset;
-       undistort_->offset = NULL;
-     }
-@@ -299,15 +304,16 @@ void CameraIntrinsics::CheckUndistortLookupGrid(int width, int height)
-   if(!undistort_->offset) {
-       undistort_->offset = new Offset[width*height];
--      ComputeLookupGrid<ApplyIntrinsicsFunction>(undistort_,width,height);
-+      ComputeLookupGrid<ApplyIntrinsicsFunction>(undistort_,width,height,overscan);
-   }
-   undistort_->width = width;
-   undistort_->height = height;
-+  undistort_->overscan = overscan;
- }
--void CameraIntrinsics::Distort(const float* src, float* dst, int width, int height, int channels) {
--  CheckDistortLookupGrid(width, height);
-+void CameraIntrinsics::Distort(const float* src, float* dst, int width, int height, double overscan, int channels) {
-+  CheckDistortLookupGrid(width, height, overscan);
-        if(channels==1) Warp<float,1>(distort_,src,dst,width,height);
-   else if(channels==2) Warp<float,2>(distort_,src,dst,width,height);
-   else if(channels==3) Warp<float,3>(distort_,src,dst,width,height);
-@@ -315,8 +321,8 @@ void CameraIntrinsics::Distort(const float* src, float* dst, int width, int heig
-   //else assert("channels must be between 1 and 4");
- }
--void CameraIntrinsics::Distort(const unsigned char* src, unsigned char* dst, int width, int height, int channels) {
--  CheckDistortLookupGrid(width, height);
-+void CameraIntrinsics::Distort(const unsigned char* src, unsigned char* dst, int width, int height, double overscan, int channels) {
-+  CheckDistortLookupGrid(width, height, overscan);
-        if(channels==1) Warp<unsigned char,1>(distort_,src,dst,width,height);
-   else if(channels==2) Warp<unsigned char,2>(distort_,src,dst,width,height);
-   else if(channels==3) Warp<unsigned char,3>(distort_,src,dst,width,height);
-@@ -324,8 +330,8 @@ void CameraIntrinsics::Distort(const unsigned char* src, unsigned char* dst, int
-   //else assert("channels must be between 1 and 4");
- }
--void CameraIntrinsics::Undistort(const float* src, float* dst, int width, int height, int channels) {
--  CheckUndistortLookupGrid(width, height);
-+void CameraIntrinsics::Undistort(const float* src, float* dst, int width, int height, double overscan, int channels) {
-+  CheckUndistortLookupGrid(width, height, overscan);
-        if(channels==1) Warp<float,1>(undistort_,src,dst,width,height);
-   else if(channels==2) Warp<float,2>(undistort_,src,dst,width,height);
-   else if(channels==3) Warp<float,3>(undistort_,src,dst,width,height);
-@@ -333,8 +339,8 @@ void CameraIntrinsics::Undistort(const float* src, float* dst, int width, int he
-   //else assert("channels must be between 1 and 4");
- }
--void CameraIntrinsics::Undistort(const unsigned char* src, unsigned char* dst, int width, int height, int channels) {
--  CheckUndistortLookupGrid(width, height);
-+void CameraIntrinsics::Undistort(const unsigned char* src, unsigned char* dst, int width, int height, double overscan, int channels) {
-+  CheckUndistortLookupGrid(width, height, overscan);
-        if(channels==1) Warp<unsigned char,1>(undistort_,src,dst,width,height);
-   else if(channels==2) Warp<unsigned char,2>(undistort_,src,dst,width,height);
-   else if(channels==3) Warp<unsigned char,3>(undistort_,src,dst,width,height);
-diff --git a/src/libmv/simple_pipeline/camera_intrinsics.h b/src/libmv/simple_pipeline/camera_intrinsics.h
-index f525571..f4bf903 100644
---- a/src/libmv/simple_pipeline/camera_intrinsics.h
-+++ b/src/libmv/simple_pipeline/camera_intrinsics.h
-@@ -91,7 +91,7 @@ class CameraIntrinsics {
-       \note This is the reference implementation using floating point images.
-   */
-   void Distort(const float* src, float* dst,
--               int width, int height, int channels);
-+               int width, int height, double overscan, int channels);
-   /*!
-       Distort an image using the current camera instrinsics
-@@ -101,7 +101,7 @@ class CameraIntrinsics {
-       \note This version is much faster.
-   */
-   void Distort(const unsigned char* src, unsigned char* dst,
--               int width, int height, int channels);
-+               int width, int height, double overscan, int channels);
-   /*!
-       Undistort an image using the current camera instrinsics
-@@ -111,7 +111,7 @@ class CameraIntrinsics {
-       \note This is the reference implementation using floating point images.
-   */
-   void Undistort(const float* src, float* dst,
--                 int width, int height, int channels);
-+                 int width, int height, double overscan, int channels);
-   /*!
-       Undistort an image using the current camera instrinsics
-@@ -121,12 +121,12 @@ class CameraIntrinsics {
-       \note This version is much faster.
-   */
-   void Undistort(const unsigned char* src, unsigned char* dst,
--                 int width, int height, int channels);
-+                 int width, int height, double overscan, int channels);
-  private:
--  template<typename WarpFunction> void ComputeLookupGrid(struct Grid* grid, int width, int height);
--  void CheckUndistortLookupGrid(int width, int height);
--  void CheckDistortLookupGrid(int width, int height);
-+  template<typename WarpFunction> void ComputeLookupGrid(struct Grid* grid, int width, int height, double overscan);
-+  void CheckUndistortLookupGrid(int width, int height, double overscan);
-+  void CheckDistortLookupGrid(int width, int height, double overscan);
-   void FreeLookupGrid();
-   // The traditional intrinsics matrix from x = K[R|t]X.
diff --git a/extern/libmv/patches/scaled_distortion.patch b/extern/libmv/patches/scaled_distortion.patch
deleted file mode 100644 (file)
index 2da8329..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-diff --git a/src/libmv/simple_pipeline/camera_intrinsics.cc b/src/libmv/simple_pipeline/camera_intrinsics.cc
-index f9888ff..110a16d 100644
---- a/src/libmv/simple_pipeline/camera_intrinsics.cc
-+++ b/src/libmv/simple_pipeline/camera_intrinsics.cc
-@@ -23,7 +23,32 @@
- namespace libmv {
--struct Offset { signed char ix,iy; unsigned char fx,fy; };
-+struct Offset {
-+  signed char ix, iy;
-+  unsigned char fx,fy;
-+};
-+
-+struct Grid {
-+  struct Offset *offset;
-+  int width, height;
-+};
-+
-+static struct Grid *copyGrid(struct Grid *from)
-+{
-+  struct Grid *to = NULL;
-+
-+  if (from) {
-+    to = new Grid;
-+
-+    to->width = from->width;
-+    to->height = from->height;
-+
-+    to->offset = new Offset[to->width*to->height];
-+    memcpy(to->offset, from->offset, sizeof(struct Offset)*to->width*to->height);
-+  }
-+
-+  return to;
-+}
- CameraIntrinsics::CameraIntrinsics()
-     : K_(Mat3::Identity()),
-@@ -37,9 +62,22 @@ CameraIntrinsics::CameraIntrinsics()
-       distort_(0),
-       undistort_(0) {}
-+CameraIntrinsics::CameraIntrinsics(const CameraIntrinsics &from)
-+    : K_(from.K_),
-+      image_width_(from.image_width_),
-+      image_height_(from.image_height_),
-+      k1_(from.k1_),
-+      k2_(from.k2_),
-+      k3_(from.k3_),
-+      p1_(from.p1_),
-+      p2_(from.p2_)
-+{
-+  distort_ = copyGrid(from.distort_);
-+  undistort_ = copyGrid(from.undistort_);
-+}
-+
- CameraIntrinsics::~CameraIntrinsics() {
--  if(distort_) delete[] distort_;
--  if(undistort_) delete[] undistort_;
-+  FreeLookupGrid();
- }
- /// Set the entire calibration matrix at once.
-@@ -146,11 +184,17 @@ void CameraIntrinsics::InvertIntrinsics(double image_x,
- // TODO(MatthiasF): downsample lookup
- template<typename WarpFunction>
--void CameraIntrinsics::ComputeLookupGrid(Offset* grid, int width, int height) {
-+void CameraIntrinsics::ComputeLookupGrid(Grid* grid, int width, int height) {
-+  double aspx = (double)width / image_width_;
-+  double aspy = (double)height / image_height_;
-+
-   for (int y = 0; y < height; y++) {
-     for (int x = 0; x < width; x++) {
-+      double src_x = x / aspx, src_y = y / aspy;
-       double warp_x, warp_y;
--      WarpFunction(this,x,y,&warp_x,&warp_y);
-+      WarpFunction(this,src_x,src_y,&warp_x,&warp_y);
-+      warp_x = warp_x*aspx;
-+      warp_y = warp_y*aspy;
-       int ix = int(warp_x), iy = int(warp_y);
-       int fx = round((warp_x-ix)*256), fy = round((warp_y-iy)*256);
-       if(fx == 256) { fx=0; ix++; }
-@@ -162,10 +206,10 @@ void CameraIntrinsics::ComputeLookupGrid(Offset* grid, int width, int height) {
-       if( iy >= height-2 ) iy = height-2;
-       if ( ix-x > -128 && ix-x < 128 && iy-y > -128 && iy-y < 128 ) {
-         Offset offset = { ix-x, iy-y, fx, fy };
--        grid[y*width+x] = offset;
-+        grid->offset[y*width+x] = offset;
-       } else {
-         Offset offset = { 0, 0, 0, 0 };
--        grid[y*width+x] = offset;
-+        grid->offset[y*width+x] = offset;
-       }
-     }
-   }
-@@ -173,11 +217,11 @@ void CameraIntrinsics::ComputeLookupGrid(Offset* grid, int width, int height) {
- // TODO(MatthiasF): cubic B-Spline image sampling, bilinear lookup
- template<typename T,int N>
--static void Warp(const Offset* grid, const T* src, T* dst,
-+static void Warp(const Grid* grid, const T* src, T* dst,
-                  int width, int height) {
-   for (int y = 0; y < height; y++) {
-     for (int x = 0; x < width; x++) {
--      Offset offset = grid[y*width+x];
-+      Offset offset = grid->offset[y*width+x];
-       const T* s = &src[((y+offset.iy)*width+(x+offset.ix))*N];
-       for (int i = 0; i < N; i++) {
-         dst[(y*width+x)*N+i] = ((s[        i] * (256-offset.fx) + s[        N+i] * offset.fx) * (256-offset.fy)
-@@ -188,8 +232,17 @@ static void Warp(const Offset* grid, const T* src, T* dst,
- }
- void CameraIntrinsics::FreeLookupGrid() {
--  if(distort_) delete distort_, distort_=0;
--  if(undistort_) delete undistort_, undistort_=0;
-+  if(distort_) {
-+    delete distort_->offset;
-+    delete distort_;
-+    distort_ = NULL;
-+  }
-+
-+  if(undistort_) {
-+    delete undistort_->offset;
-+    delete undistort_;
-+    undistort_ = NULL;
-+  }
- }
- // FIXME: C++ templates limitations makes thing complicated, but maybe there is a simpler method.
-@@ -211,11 +264,50 @@ struct InvertIntrinsicsFunction {
-   }
- };
--void CameraIntrinsics::Distort(const float* src, float* dst, int width, int height, int channels) {
--  if(!distort_) {
--    distort_ = new Offset[width*height];
--    ComputeLookupGrid<InvertIntrinsicsFunction>(distort_,width,height);
-+void CameraIntrinsics::CheckDistortLookupGrid(int width, int height)
-+{
-+  if(distort_) {
-+    if(distort_->width != width || distort_->height != height) {
-+      delete [] distort_->offset;
-+      distort_->offset = NULL;
-+    }
-+  } else {
-+    distort_ = new Grid;
-+    distort_->offset = NULL;
-+  }
-+
-+  if(!distort_->offset) {
-+      distort_->offset = new Offset[width*height];
-+      ComputeLookupGrid<InvertIntrinsicsFunction>(distort_,width,height);
-   }
-+
-+  distort_->width = width;
-+  distort_->height = height;
-+}
-+
-+void CameraIntrinsics::CheckUndistortLookupGrid(int width, int height)
-+{
-+  if(undistort_) {
-+    if(undistort_->width != width || undistort_->height != height) {
-+      delete [] undistort_->offset;
-+      undistort_->offset = NULL;
-+    }
-+  } else {
-+    undistort_ = new Grid;
-+    undistort_->offset = NULL;
-+  }
-+
-+  if(!undistort_->offset) {
-+      undistort_->offset = new Offset[width*height];
-+      ComputeLookupGrid<ApplyIntrinsicsFunction>(undistort_,width,height);
-+  }
-+
-+  undistort_->width = width;
-+  undistort_->height = height;
-+}
-+
-+void CameraIntrinsics::Distort(const float* src, float* dst, int width, int height, int channels) {
-+  CheckDistortLookupGrid(width, height);
-        if(channels==1) Warp<float,1>(distort_,src,dst,width,height);
-   else if(channels==2) Warp<float,2>(distort_,src,dst,width,height);
-   else if(channels==3) Warp<float,3>(distort_,src,dst,width,height);
-@@ -224,10 +316,7 @@ void CameraIntrinsics::Distort(const float* src, float* dst, int width, int heig
- }
- void CameraIntrinsics::Distort(const unsigned char* src, unsigned char* dst, int width, int height, int channels) {
--  if(!distort_) {
--    distort_ = new Offset[width*height];
--    ComputeLookupGrid<InvertIntrinsicsFunction>(distort_,width,height);
--  }
-+  CheckDistortLookupGrid(width, height);
-        if(channels==1) Warp<unsigned char,1>(distort_,src,dst,width,height);
-   else if(channels==2) Warp<unsigned char,2>(distort_,src,dst,width,height);
-   else if(channels==3) Warp<unsigned char,3>(distort_,src,dst,width,height);
-@@ -236,10 +325,7 @@ void CameraIntrinsics::Distort(const unsigned char* src, unsigned char* dst, int
- }
- void CameraIntrinsics::Undistort(const float* src, float* dst, int width, int height, int channels) {
--  if(!undistort_) {
--    undistort_ = new Offset[width*height];
--    ComputeLookupGrid<ApplyIntrinsicsFunction>(undistort_,width,height);
--  }
-+  CheckUndistortLookupGrid(width, height);
-        if(channels==1) Warp<float,1>(undistort_,src,dst,width,height);
-   else if(channels==2) Warp<float,2>(undistort_,src,dst,width,height);
-   else if(channels==3) Warp<float,3>(undistort_,src,dst,width,height);
-@@ -248,10 +334,7 @@ void CameraIntrinsics::Undistort(const float* src, float* dst, int width, int he
- }
- void CameraIntrinsics::Undistort(const unsigned char* src, unsigned char* dst, int width, int height, int channels) {
--  if(!undistort_) {
--    undistort_ = new Offset[width*height];
--    ComputeLookupGrid<ApplyIntrinsicsFunction>(undistort_,width,height);
--  }
-+  CheckUndistortLookupGrid(width, height);
-        if(channels==1) Warp<unsigned char,1>(undistort_,src,dst,width,height);
-   else if(channels==2) Warp<unsigned char,2>(undistort_,src,dst,width,height);
-   else if(channels==3) Warp<unsigned char,3>(undistort_,src,dst,width,height);
-diff --git a/src/libmv/simple_pipeline/camera_intrinsics.h b/src/libmv/simple_pipeline/camera_intrinsics.h
-index 29bc8a1..f525571 100644
---- a/src/libmv/simple_pipeline/camera_intrinsics.h
-+++ b/src/libmv/simple_pipeline/camera_intrinsics.h
-@@ -26,11 +26,12 @@ typedef Eigen::Matrix<double, 3, 3> Mat3;
- namespace libmv {
--struct Offset;
-+struct Grid;
- class CameraIntrinsics {
-  public:
-   CameraIntrinsics();
-+  CameraIntrinsics(const CameraIntrinsics &from);
-   ~CameraIntrinsics();
-   const Mat3 &K()                 const { return K_;            }
-@@ -123,7 +124,9 @@ class CameraIntrinsics {
-                  int width, int height, int channels);
-  private:
--  template<typename WarpFunction> void ComputeLookupGrid(Offset* grid, int width, int height);
-+  template<typename WarpFunction> void ComputeLookupGrid(struct Grid* grid, int width, int height);
-+  void CheckUndistortLookupGrid(int width, int height);
-+  void CheckDistortLookupGrid(int width, int height);
-   void FreeLookupGrid();
-   // The traditional intrinsics matrix from x = K[R|t]X.
-@@ -140,8 +143,8 @@ class CameraIntrinsics {
-   // independent of image size.
-   double k1_, k2_, k3_, p1_, p2_;
--  Offset* distort_;
--  Offset* undistort_;
-+  struct Grid *distort_;
-+  struct Grid *undistort_;
- };
- }  // namespace libmv
index 00a52c1cfaa6c60b01df5505ade687151e31be08..ca671122a618048fcc12014a52bf2c149a690441 100644 (file)
@@ -1,13 +1,2 @@
 v3d_verbosity.patch
-snrptinf_fix.patch
 bundle_tweaks.patch
-fast.patch
-config_mac.patch
-levenberg_marquardt.patch
-function_derivative.patch
-high_distortion_crash_fix.patch
-mingw.patch
-msvc2010.patch
-scaled_distortion.patch
-overscan.patch
-detect.patch
diff --git a/extern/libmv/patches/snrptinf_fix.patch b/extern/libmv/patches/snrptinf_fix.patch
deleted file mode 100644 (file)
index e886a67..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/src/libmv/simple_pipeline/pipeline.cc b/src/libmv/simple_pipeline/pipeline.cc
-index 652d70c..25cd2c2 100644
---- a/src/libmv/simple_pipeline/pipeline.cc
-+++ b/src/libmv/simple_pipeline/pipeline.cc
-@@ -28,6 +28,10 @@
- #include "libmv/simple_pipeline/tracks.h"
- #include "libmv/simple_pipeline/camera_intrinsics.h"
-+#ifdef _MSC_VER
-+#  define snprintf _snprintf
-+#endif
-+
- namespace libmv {
- void CompleteReconstruction(const Tracks &tracks,
index a54f3dc44be76d5a6108834101fbf0ac0be8d43f..f5c6afbd0b52cc34e4ad4e93e1e51c252ca3b4b0 100644 (file)
@@ -1,12 +1,12 @@
 diff --git a/src/libmv/simple_pipeline/bundle.cc b/src/libmv/simple_pipeline/bundle.cc
-index 310660d..f819603 100644
+index fa0b6cc..d382cd5 100644
 --- a/src/libmv/simple_pipeline/bundle.cc
 +++ b/src/libmv/simple_pipeline/bundle.cc
-@@ -141,7 +141,6 @@ void Bundle(const Tracks &tracks, Reconstruction *reconstruction) {
-   v3d_distortion.p2 = 0;
+@@ -194,7 +194,6 @@ void EuclideanBundleCommonIntrinsics(const Tracks &tracks,
+   double v3d_inlier_threshold = 500000.0;
  
    // Finally, run the bundle adjustment.
 -  V3D::optimizerVerbosenessLevel = 1;
-   double const inlierThreshold = 500000.0;
-   V3D::CommonInternalsMetricBundleOptimizer opt(V3D::FULL_BUNDLE_METRIC,
-                                                 inlierThreshold,
+   V3D::CommonInternalsMetricBundleOptimizer opt(v3d_bundle_intrinsics,
+                                                 v3d_inlier_threshold,
+                                                 v3d_K,