diff options
Diffstat (limited to 'extern/libmv')
-rw-r--r-- | extern/libmv/CMakeLists.txt | 366 | ||||
-rw-r--r-- | extern/libmv/SConscript | 55 | ||||
-rwxr-xr-x | extern/libmv/bundle.sh | 175 | ||||
-rw-r--r-- | extern/libmv/libmv-capi.cc (renamed from extern/libmv/libmv-capi.cpp) | 0 | ||||
-rw-r--r-- | extern/libmv/libmv-capi_stub.cc | 277 |
5 files changed, 598 insertions, 275 deletions
diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt index 71554795355..a18011fc599 100644 --- a/extern/libmv/CMakeLists.txt +++ b/extern/libmv/CMakeLists.txt @@ -28,198 +28,216 @@ set(INC . - third_party/ceres/include -) - -set(INC_SYS - ../Eigen3 - ${PNG_INCLUDE_DIR} - ${ZLIB_INCLUDE_DIRS} ) 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/homography.cc - libmv/multiview/panography.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/camera_intrinsics.cc - libmv/simple_pipeline/detect.cc - libmv/simple_pipeline/initialize_reconstruction.cc - libmv/simple_pipeline/intersect.cc - libmv/simple_pipeline/modal_solver.cc - libmv/simple_pipeline/pipeline.cc - libmv/simple_pipeline/reconstruction.cc - libmv/simple_pipeline/reconstruction_scale.cc - libmv/simple_pipeline/resect.cc - libmv/simple_pipeline/tracks.cc - libmv/tracking/brute_region_tracker.cc - libmv/tracking/esm_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/tracking/track_region.cc - libmv/tracking/trklt_region_tracker.cc - - 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 - 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/correlation.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/homography.h - libmv/multiview/homography_parameterization.h - libmv/multiview/nviewtriangulation.h - libmv/multiview/panography.h - libmv/multiview/projection.h - libmv/multiview/resection.h - libmv/multiview/triangulation.h - libmv/numeric/dogleg.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/camera_intrinsics.h - libmv/simple_pipeline/detect.h - libmv/simple_pipeline/initialize_reconstruction.h - libmv/simple_pipeline/intersect.h - libmv/simple_pipeline/modal_solver.h - libmv/simple_pipeline/pipeline.h - libmv/simple_pipeline/reconstruction.h - libmv/simple_pipeline/reconstruction_scale.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/track_region.h - libmv/tracking/trklt_region_tracker.h - - third_party/fast/fast.h - third_party/gflags/config.h - third_party/gflags/gflags/gflags_completions.h - third_party/gflags/gflags/gflags_declare.h - third_party/gflags/gflags/gflags.h - third_party/gflags/mutex.h - third_party/gflags/util.h - third_party/msinttypes/inttypes.h - third_party/msinttypes/stdint.h ) -if(WIN32) - list(APPEND SRC - third_party/glog/src/logging.cc - third_party/glog/src/raw_logging.cc - third_party/glog/src/utilities.cc - third_party/glog/src/vlog_is_on.cc - third_party/glog/src/windows/port.cc - - third_party/glog/src/utilities.h - third_party/glog/src/stacktrace_generic-inl.h - third_party/glog/src/stacktrace.h - third_party/glog/src/stacktrace_x86_64-inl.h - third_party/glog/src/base/googleinit.h - third_party/glog/src/base/mutex.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 +if(WITH_LIBMV) + add_definitions( + -DWITH_LIBMV ) list(APPEND INC - third_party/glog/src/windows + third_party/ceres/include + ) + + set(INC_SYS + ../Eigen3 + ${PNG_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIRS} ) - if(NOT MINGW) + list(APPEND SRC + libmv-capi.cc + libmv/image/array_nd.cc + libmv/image/convolve.cc + libmv/multiview/conditioning.cc + libmv/multiview/euclidean_resection.cc + libmv/multiview/fundamental.cc + libmv/multiview/homography.cc + libmv/multiview/panography.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/camera_intrinsics.cc + libmv/simple_pipeline/detect.cc + libmv/simple_pipeline/initialize_reconstruction.cc + libmv/simple_pipeline/intersect.cc + libmv/simple_pipeline/modal_solver.cc + libmv/simple_pipeline/pipeline.cc + libmv/simple_pipeline/reconstruction.cc + libmv/simple_pipeline/reconstruction_scale.cc + libmv/simple_pipeline/resect.cc + libmv/simple_pipeline/tracks.cc + libmv/tracking/brute_region_tracker.cc + libmv/tracking/esm_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/tracking/track_region.cc + libmv/tracking/trklt_region_tracker.cc + + 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 + + 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/correlation.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/homography.h + libmv/multiview/homography_parameterization.h + libmv/multiview/nviewtriangulation.h + libmv/multiview/panography.h + libmv/multiview/projection.h + libmv/multiview/resection.h + libmv/multiview/triangulation.h + libmv/numeric/dogleg.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/camera_intrinsics.h + libmv/simple_pipeline/detect.h + libmv/simple_pipeline/initialize_reconstruction.h + libmv/simple_pipeline/intersect.h + libmv/simple_pipeline/modal_solver.h + libmv/simple_pipeline/pipeline.h + libmv/simple_pipeline/reconstruction.h + libmv/simple_pipeline/reconstruction_scale.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/track_region.h + libmv/tracking/trklt_region_tracker.h + + third_party/fast/fast.h + third_party/gflags/config.h + third_party/gflags/gflags/gflags_completions.h + third_party/gflags/gflags/gflags_declare.h + third_party/gflags/gflags/gflags.h + third_party/gflags/mutex.h + third_party/gflags/util.h + third_party/msinttypes/inttypes.h + third_party/msinttypes/stdint.h + ) + + if(WIN32) + list(APPEND SRC + third_party/glog/src/logging.cc + third_party/glog/src/raw_logging.cc + third_party/glog/src/utilities.cc + third_party/glog/src/vlog_is_on.cc + third_party/glog/src/windows/port.cc + + third_party/glog/src/utilities.h + third_party/glog/src/stacktrace_generic-inl.h + third_party/glog/src/stacktrace.h + third_party/glog/src/stacktrace_x86_64-inl.h + third_party/glog/src/base/googleinit.h + third_party/glog/src/base/mutex.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 + third_party/glog/src/windows + ) + + if(NOT MINGW) + list(APPEND INC + third_party/msinttypes + ) + endif() + else() + list(APPEND SRC + 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/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_hurd.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/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_64-inl.h + third_party/glog/src/stacktrace_x86-inl.h + third_party/glog/src/symbolize.h + third_party/glog/src/utilities.h + ) + list(APPEND INC - third_party/msinttypes + third_party/glog/src ) endif() + + add_definitions( + -DGOOGLE_GLOG_DLL_DECL= + ) else() list(APPEND SRC - 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/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_hurd.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/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_64-inl.h - third_party/glog/src/stacktrace_x86-inl.h - third_party/glog/src/symbolize.h - third_party/glog/src/utilities.h - ) - - list(APPEND INC - third_party/glog/src + libmv-capi_stub.cc ) endif() -add_definitions( - -DGOOGLE_GLOG_DLL_DECL= -) - blender_add_lib(extern_libmv "${SRC}" "${INC}" "${INC_SYS}") -add_subdirectory(third_party) +if(WITH_LIBMV) + add_subdirectory(third_party) +endif() diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript index d0015db42d7..ec616ff2adf 100644 --- a/extern/libmv/SConscript +++ b/extern/libmv/SConscript @@ -11,32 +11,37 @@ Import('env') defs = [] -defs.append('GOOGLE_GLOG_DLL_DECL=') - -src = env.Glob("*.cpp") -src += env.Glob('libmv/image/*.cc') -src += env.Glob('libmv/multiview/*.cc') -src += env.Glob('libmv/numeric/*.cc') -src += env.Glob('libmv/simple_pipeline/*.cc') -src += env.Glob('libmv/tracking/*.cc') -src += env.Glob('third_party/fast/*.c') -src += env.Glob('third_party/gflags/*.cc') - -incs = '. ../Eigen3 third_party/ceres/include' -incs += ' ' + env['BF_PNG_INC'] -incs += ' ' + env['BF_ZLIB_INC'] - -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): - incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog' - if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - incs += ' ./third_party/msinttypes' - - src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] - src += ['./third_party/glog/src/windows/port.cc'] +if env['WITH_BF_LIBMV']: + defs.append('GOOGLE_GLOG_DLL_DECL=') + defs.append('WITH_LIBMV') + + src = env.Glob("libmv-capi.cc") + src += env.Glob('libmv/image/*.cc') + src += env.Glob('libmv/multiview/*.cc') + src += env.Glob('libmv/numeric/*.cc') + src += env.Glob('libmv/simple_pipeline/*.cc') + src += env.Glob('libmv/tracking/*.cc') + src += env.Glob('third_party/fast/*.c') + src += env.Glob('third_party/gflags/*.cc') + + incs = '. ../Eigen3 third_party/ceres/include' + incs += ' ' + env['BF_PNG_INC'] + incs += ' ' + env['BF_ZLIB_INC'] + + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): + incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog' + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): + incs += ' ./third_party/msinttypes' + + src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] + src += ['./third_party/glog/src/windows/port.cc'] + else: + src += env.Glob("third_party/glog/src/*.cc") + incs += ' ./third_party/glog/src' else: - src += env.Glob("third_party/glog/src/*.cc") - incs += ' ./third_party/glog/src' + src = env.Glob("libmv-capi_stub.cc") env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] ) -SConscript(['third_party/SConscript']) +if env['WITH_BF_LIBMV']: + SConscript(['third_party/SConscript']) diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh index a9edfde55bf..4a52cf2fd18 100755 --- a/extern/libmv/bundle.sh +++ b/extern/libmv/bundle.sh @@ -38,17 +38,17 @@ rm -rf $tmp chmod 664 ./third_party/glog/src/windows/*.cc ./third_party/glog/src/windows/*.h ./third_party/glog/src/windows/glog/*.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` +sources=`find ./libmv -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | sed -r 's/^\.\//\t\t/' | sort -d` +headers=`find ./libmv -type f -iname '*.h' | sed -r 's/^\.\//\t\t/' | sort -d` -third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v glog | grep -v ceres | sed -r 's/^\.\//\t/' | sort -d` -third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | grep -v ceres | sed -r 's/^\.\//\t/' | sort -d` +third_sources=`find ./third_party -type f -iname '*.cc' -or -iname '*.cpp' -or -iname '*.c' | grep -v glog | grep -v ceres | sed -r 's/^\.\//\t\t/' | sort -d` +third_headers=`find ./third_party -type f -iname '*.h' | grep -v glog | grep -v ceres | sed -r 's/^\.\//\t\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 -d` -third_glog_headers=`find ./third_party -type f -iname '*.h' | grep glog | grep -v windows | sed -r 's/^\.\//\t\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\t/' | sort -d` +third_glog_headers=`find ./third_party -type f -iname '*.h' | grep glog | grep -v windows | sed -r 's/^\.\//\t\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 -d | uniq` -src_third_dir=`find ./third_party -type f -iname '*.cc' -exec dirname {} \; -or -iname '*.cpp' -exec dirname {} \; -or -iname '*.c' -exec dirname {} \; | grep -v ceres | sed -r 's/^\.\//\t/' | sort -d | 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\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 {} \; | grep -v ceres | sed -r 's/^\.\//\t\t/' | sort -d | uniq` src="" win_src="" for x in $src_dir $src_third_dir; do @@ -59,12 +59,12 @@ for x in $src_dir $src_third_dir; do fi if stat $x/*.cpp > /dev/null 2>&1; then - t="src += env.Glob('`echo $x'/*.cpp'`')" + t=" src += env.Glob('`echo $x'/*.cpp'`')" fi if stat $x/*.c > /dev/null 2>&1; then if [ -z "$t" ]; then - t="src += env.Glob('`echo $x'/*.c'`')" + t=" src += env.Glob('`echo $x'/*.c'`')" else t="$t + env.Glob('`echo $x'/*.c'`')" fi @@ -72,7 +72,7 @@ for x in $src_dir $src_third_dir; do if stat $x/*.cc > /dev/null 2>&1; then if [ -z "$t" ]; then - t="src += env.Glob('`echo $x'/*.cc'`')" + t=" src += env.Glob('`echo $x'/*.cc'`')" else t="$t + env.Glob('`echo $x'/*.cc'`')" fi @@ -124,82 +124,100 @@ cat > CMakeLists.txt << EOF set(INC . - third_party/ceres/include ) -set(INC_SYS - ../Eigen3 - \${PNG_INCLUDE_DIR} - \${ZLIB_INCLUDE_DIRS} +set(SRC + libmv-capi.h ) -set(SRC - libmv-capi.cpp +if(WITH_LIBMV) + add_definitions( + -DWITH_LIBMV + ) + + list(APPEND INC + third_party/ceres/include + ) + + set(INC_SYS + ../Eigen3 + \${PNG_INCLUDE_DIR} + \${ZLIB_INCLUDE_DIRS} + ) + + list(APPEND SRC + libmv-capi.cc ${sources} ${third_sources} - libmv-capi.h ${headers} ${third_headers} -) - -if(WIN32) - list(APPEND SRC - third_party/glog/src/logging.cc - third_party/glog/src/raw_logging.cc - third_party/glog/src/utilities.cc - third_party/glog/src/vlog_is_on.cc - third_party/glog/src/windows/port.cc - - third_party/glog/src/utilities.h - third_party/glog/src/stacktrace_generic-inl.h - third_party/glog/src/stacktrace.h - third_party/glog/src/stacktrace_x86_64-inl.h - third_party/glog/src/base/googleinit.h - third_party/glog/src/base/mutex.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 - third_party/glog/src/windows - ) + if(WIN32) + list(APPEND SRC + third_party/glog/src/logging.cc + third_party/glog/src/raw_logging.cc + third_party/glog/src/utilities.cc + third_party/glog/src/vlog_is_on.cc + third_party/glog/src/windows/port.cc + + third_party/glog/src/utilities.h + third_party/glog/src/stacktrace_generic-inl.h + third_party/glog/src/stacktrace.h + third_party/glog/src/stacktrace_x86_64-inl.h + third_party/glog/src/base/googleinit.h + third_party/glog/src/base/mutex.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 + ) - if(NOT MINGW) list(APPEND INC - third_party/msinttypes + third_party/glog/src/windows ) - endif() -else() - list(APPEND SRC + + if(NOT MINGW) + list(APPEND INC + third_party/msinttypes + ) + endif() + else() + list(APPEND SRC ${third_glog_sources} ${third_glog_headers} - ) + ) - list(APPEND INC - third_party/glog/src + list(APPEND INC + third_party/glog/src + ) + endif() + + add_definitions( + -DGOOGLE_GLOG_DLL_DECL= + ) +else() + list(APPEND SRC + libmv-capi_stub.cc ) endif() -add_definitions( - -DGOOGLE_GLOG_DLL_DECL= -) - blender_add_lib(extern_libmv "\${SRC}" "\${INC}" "\${INC_SYS}") -add_subdirectory(third_party) +if(WITH_LIBMV) + add_subdirectory(third_party) +endif() EOF cat > SConscript << EOF @@ -216,27 +234,32 @@ Import('env') defs = [] -defs.append('GOOGLE_GLOG_DLL_DECL=') +if env['WITH_BF_LIBMV']: + defs.append('GOOGLE_GLOG_DLL_DECL=') + defs.append('WITH_LIBMV') -src = env.Glob("*.cpp") + src = env.Glob("libmv-capi.cc") $src -incs = '. ../Eigen3 third_party/ceres/include' -incs += ' ' + env['BF_PNG_INC'] -incs += ' ' + env['BF_ZLIB_INC'] + incs = '. ../Eigen3 third_party/ceres/include' + incs += ' ' + env['BF_PNG_INC'] + incs += ' ' + env['BF_ZLIB_INC'] -if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): - incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog' - if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - incs += ' ./third_party/msinttypes' + if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): + incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog' + if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): + incs += ' ./third_party/msinttypes' ${win_src} - src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] - src += ['./third_party/glog/src/windows/port.cc'] + src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc'] + src += ['./third_party/glog/src/windows/port.cc'] + else: + src += env.Glob("third_party/glog/src/*.cc") + incs += ' ./third_party/glog/src' else: - src += env.Glob("third_party/glog/src/*.cc") - incs += ' ./third_party/glog/src' + src = env.Glob("libmv-capi_stub.cc") env.BlenderLib ( libname = 'extern_libmv', sources=src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137] ) -SConscript(['third_party/SConscript']) +if env['WITH_BF_LIBMV']: + SConscript(['third_party/SConscript']) EOF diff --git a/extern/libmv/libmv-capi.cpp b/extern/libmv/libmv-capi.cc index 4aa8093aba9..4aa8093aba9 100644 --- a/extern/libmv/libmv-capi.cpp +++ b/extern/libmv/libmv-capi.cc diff --git a/extern/libmv/libmv-capi_stub.cc b/extern/libmv/libmv-capi_stub.cc new file mode 100644 index 00000000000..5f6df585c8b --- /dev/null +++ b/extern/libmv/libmv-capi_stub.cc @@ -0,0 +1,277 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2013 Blender Foundation. + * All rights reserved. + * + * Contributor(s): Blender Foundation, + * Sergey Sharybin + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef WITH_LIBMV + +#include "libmv-capi.h" + +#include <cstdlib> +#include <cstring> + +/* ************ Logging ************ */ + +void libmv_initLogging(const char * /*argv0*/) +{ +} + +void libmv_startDebugLogging(void) +{ +} + +void libmv_setLoggingVerbosity(int /*verbosity*/) +{ +} + +/* ************ Planar tracker ************ */ + +/* TrackRegion (new planar tracker) */ +int libmv_trackRegion(const struct libmv_trackRegionOptions * /*options*/, + const float * /*image1*/, int /*image1_width*/, int /*image1_height*/, + const float * /*image2*/, int /*image2_width*/, int /*image2_height*/, + const double *x1, const double *y1, + struct libmv_trackRegionResult *result, + double *x2, double *y2) +{ + /* Convert to doubles for the libmv api. The four corners and the center. */ + for (int i = 0; i < 5; ++i) { + x2[i] = x1[i]; + y2[i] = y1[i]; + } + + result->termination = -1; + result->termination_reason = "Built without libmv support"; + result->correlation = 0.0; + + return false; +} + +void libmv_samplePlanarPatch(const float *image, int width, int height, + int channels, const double *xs, const double *ys, + int num_samples_x, int num_samples_y, + const float *mask, float *patch, + double *warped_position_x, double *warped_position_y) +{ + /* TODO(sergey): implement */ +} + +/* ************ Tracks ************ */ + +libmv_Tracks *libmv_tracksNew(void) { + return NULL; +} + +void libmv_tracksInsert(struct libmv_Tracks * /*libmv_tracks*/, int /*image*/, + int /*track*/, double /*x*/, double /*y*/) +{ +} + +void libmv_tracksDestroy(libmv_Tracks * /*libmv_tracks*/) +{ +} + +/* ************ Reconstruction solver ************ */ + +libmv_Reconstruction *libmv_solveReconstruction(libmv_Tracks * /*libmv_tracks*/, + libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/, + libmv_reconstructionOptions * /*libmv_reconstruction_options*/, + reconstruct_progress_update_cb /*progress_update_callback*/, + void * /*callback_customdata*/) +{ + return NULL; +} + +struct libmv_Reconstruction *libmv_solveModal(struct libmv_Tracks * /*libmv_tracks*/, + libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/, + libmv_reconstructionOptions * /*libmv_reconstruction_options*/, + reconstruct_progress_update_cb /*progress_update_callback*/, + void * /*callback_customdata*/) +{ + return NULL; +} + +int libmv_reporojectionPointForTrack(libmv_Reconstruction * /*libmv_reconstruction*/, + int /*track*/, double /*pos*/[3]) +{ + return 0; +} + +double libmv_reporojectionErrorForTrack(libmv_Reconstruction * /*libmv_reconstruction*/, int /*track*/) +{ + return 0.0; +} + +double libmv_reporojectionErrorForImage(libmv_Reconstruction * /*libmv_reconstruction*/, int /*image*/) +{ + return 0.0; +} + +int libmv_reporojectionCameraForImage(libmv_Reconstruction * /*libmv_reconstruction*/, int /*image*/, + double /*mat*/[4][4]) +{ + return 0; +} + +double libmv_reprojectionError(libmv_Reconstruction * /*libmv_reconstruction*/) +{ + return 0.0; +} + +void libmv_destroyReconstruction(libmv_Reconstruction * /*libmv_reconstruction*/) +{ +} + +/* ************ feature detector ************ */ + +struct libmv_Features *libmv_detectFeaturesFAST(unsigned char * /*data*/, + int /*width*/, int /*height*/, int /*stride*/, + int /*margin*/, int /*min_trackness*/, int /*min_distance*/) +{ + return NULL; +} + +struct libmv_Features *libmv_detectFeaturesMORAVEC(unsigned char * /*data*/, + int /*width*/, int /*height*/, int /*stride*/, + int /*margin*/, int /*count*/, int /*min_distance*/) +{ + return NULL; +} + +int libmv_countFeatures(struct libmv_Features * /*libmv_features*/) +{ + return 0; +} + +void libmv_getFeature(struct libmv_Features * /*libmv_features*/, int /*number*/, + double *x, double *y, double *score, double *size) +{ + *x = 0.0; + *y = 0.0; + *score = 0.0; + *size = 0.0; +} + +void libmv_destroyFeatures(struct libmv_Features * /*libmv_features*/) +{ +} + +/* ************ camera intrinsics ************ */ + +struct libmv_CameraIntrinsics *libmv_ReconstructionExtractIntrinsics( + struct libmv_Reconstruction * /*libmv_Reconstruction*/) +{ + return NULL; +} + +struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNewEmpty(void) +{ + return NULL; +} + +struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsNew(libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/) +{ + return NULL; +} + +struct libmv_CameraIntrinsics *libmv_CameraIntrinsicsCopy(struct libmv_CameraIntrinsics * /*libmvIntrinsics*/) +{ + return NULL; +} + +void libmv_CameraIntrinsicsDestroy(struct libmv_CameraIntrinsics * /*libmvIntrinsics*/) +{ +} + +void libmv_CameraIntrinsicsUpdate(struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, + libmv_cameraIntrinsicsOptions * /*libmv_camera_intrinsics_options*/) +{ +} + +void libmv_CameraIntrinsicsSetThreads(struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, int /*threads*/) +{ +} + +void libmv_CameraIntrinsicsExtract(struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, double * focal_length, + double * principal_x, double *principal_y, double *k1, double *k2, double *k3, + int *width, int *height) +{ + *focal_length = 1.0; + *principal_x = 0.0; + *principal_y = 0.0; + *k1 = 0.0; + *k2 = 0.0; + *width = 0.0; + *height = 0.0; +} + +void libmv_CameraIntrinsicsUndistortByte(struct libmv_CameraIntrinsics * /*libmv_intrinsics*/, + unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels) +{ + memcpy(dst, src, channels * width * height * sizeof(unsigned char)); +} + +void libmv_CameraIntrinsicsUndistortFloat(struct libmv_CameraIntrinsics * /*libmvIntrinsics*/, + float *src, float *dst, int width, int height, float overscan, int channels) +{ + memcpy(dst, src, channels * width * height * sizeof(float)); +} + +void libmv_CameraIntrinsicsDistortByte(struct libmv_CameraIntrinsics *libmvIntrinsics, + unsigned char *src, unsigned char *dst, int width, int height, float overscan, int channels) +{ + memcpy(dst, src, channels * width * height * sizeof(unsigned char)); +} + +void libmv_CameraIntrinsicsDistortFloat(struct libmv_CameraIntrinsics *libmvIntrinsics, + float *src, float *dst, int width, int height, float overscan, int channels) +{ + memcpy(dst, src, channels * width * height * sizeof(float)); +} + +/* ************ utils ************ */ + +void libmv_ApplyCameraIntrinsics(libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, + double x, double y, double *x1, double *y1) +{ + double focal_length = libmv_camera_intrinsics_options->focal_length; + double principal_x = libmv_camera_intrinsics_options->principal_point_x; + double principal_y = libmv_camera_intrinsics_options->principal_point_y; + + *x1 = x * focal_length + principal_x; + *y1 = y * focal_length + principal_y; +} + +void libmv_InvertCameraIntrinsics(libmv_cameraIntrinsicsOptions *libmv_camera_intrinsics_options, + double x, double y, double *x1, double *y1) +{ + double focal_length = libmv_camera_intrinsics_options->focal_length; + double principal_x = libmv_camera_intrinsics_options->principal_point_x; + double principal_y = libmv_camera_intrinsics_options->principal_point_y; + + *x1 = (x - principal_x) / focal_length; + *y1 = (y - principal_y) / focal_length; +} + +#endif // ifndef WITH_LIBMV |