Remplace bunch of annoying ifdefs in tracking.c with a libmv-capi_stub.cc

Makes code in tracking.cc much easier to understand and modify,
without worring to breck compulation with Libmv disabled.

It is still possible compilation will break due to libmv-capi
changes, but that's not happening so much often.
This commit is contained in:
Sergey Sharybin
2013-05-12 22:17:37 +00:00
parent 5c2355d364
commit 32faec1a53
12 changed files with 608 additions and 431 deletions

View File

@@ -29,6 +29,7 @@ remove_strict_flags()
add_subdirectory(colamd) add_subdirectory(colamd)
add_subdirectory(rangetree) add_subdirectory(rangetree)
add_subdirectory(wcwidth) add_subdirectory(wcwidth)
add_subdirectory(libmv)
if(WITH_BULLET) if(WITH_BULLET)
if(NOT WITH_SYSTEM_BULLET) if(NOT WITH_SYSTEM_BULLET)
@@ -69,10 +70,6 @@ if(WITH_LZMA)
add_subdirectory(lzma) add_subdirectory(lzma)
endif() endif()
if(WITH_LIBMV)
add_subdirectory(libmv)
endif()
if(WITH_MOD_BOOLEAN) if(WITH_MOD_BOOLEAN)
add_subdirectory(carve) add_subdirectory(carve)
endif() endif()

4
extern/SConscript vendored
View File

@@ -6,6 +6,7 @@ SConscript(['glew/SConscript'])
SConscript(['colamd/SConscript']) SConscript(['colamd/SConscript'])
SConscript(['rangetree/SConscript']) SConscript(['rangetree/SConscript'])
SConscript(['wcwidth/SConscript']) SConscript(['wcwidth/SConscript'])
SConscript(['libmv/SConscript'])
if env['WITH_BF_GAMEENGINE']: if env['WITH_BF_GAMEENGINE']:
SConscript(['recastnavigation/SConscript']) SConscript(['recastnavigation/SConscript'])
@@ -34,9 +35,6 @@ if env['WITH_BF_LZO']:
if env['WITH_BF_LZMA']: if env['WITH_BF_LZMA']:
SConscript(['lzma/SConscript']) SConscript(['lzma/SConscript'])
if env['WITH_BF_LIBMV']:
SConscript(['libmv/SConscript'])
if env['WITH_BF_BOOLEAN']: if env['WITH_BF_BOOLEAN']:
SConscript(['carve/SConscript']) SConscript(['carve/SConscript'])

View File

@@ -28,17 +28,29 @@
set(INC set(INC
. .
third_party/ceres/include
)
set(INC_SYS
../Eigen3
${PNG_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
) )
set(SRC set(SRC
libmv-capi.cpp libmv-capi.h
)
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
libmv/image/array_nd.cc libmv/image/array_nd.cc
libmv/image/convolve.cc libmv/image/convolve.cc
libmv/multiview/conditioning.cc libmv/multiview/conditioning.cc
@@ -81,7 +93,6 @@ set(SRC
third_party/gflags/gflags_completions.cc third_party/gflags/gflags_completions.cc
third_party/gflags/gflags_reporting.cc third_party/gflags/gflags_reporting.cc
libmv-capi.h
libmv/base/id_generator.h libmv/base/id_generator.h
libmv/base/scoped_ptr.h libmv/base/scoped_ptr.h
libmv/base/vector.h libmv/base/vector.h
@@ -140,9 +151,9 @@ set(SRC
third_party/gflags/util.h third_party/gflags/util.h
third_party/msinttypes/inttypes.h third_party/msinttypes/inttypes.h
third_party/msinttypes/stdint.h third_party/msinttypes/stdint.h
) )
if(WIN32) if(WIN32)
list(APPEND SRC list(APPEND SRC
third_party/glog/src/logging.cc third_party/glog/src/logging.cc
third_party/glog/src/raw_logging.cc third_party/glog/src/raw_logging.cc
@@ -178,7 +189,7 @@ if(WIN32)
third_party/msinttypes third_party/msinttypes
) )
endif() endif()
else() else()
list(APPEND SRC list(APPEND SRC
third_party/glog/src/demangle.cc third_party/glog/src/demangle.cc
third_party/glog/src/logging.cc third_party/glog/src/logging.cc
@@ -214,12 +225,19 @@ else()
list(APPEND INC list(APPEND INC
third_party/glog/src third_party/glog/src
) )
endif() endif()
add_definitions( add_definitions(
-DGOOGLE_GLOG_DLL_DECL= -DGOOGLE_GLOG_DLL_DECL=
) )
else()
list(APPEND SRC
libmv-capi_stub.cc
)
endif()
blender_add_lib(extern_libmv "${SRC}" "${INC}" "${INC_SYS}") blender_add_lib(extern_libmv "${SRC}" "${INC}" "${INC_SYS}")
add_subdirectory(third_party) if(WITH_LIBMV)
add_subdirectory(third_party)
endif()

View File

@@ -11,32 +11,37 @@ Import('env')
defs = [] 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 += env.Glob('libmv/image/*.cc') src += env.Glob('libmv/image/*.cc')
src += env.Glob('libmv/multiview/*.cc') src += env.Glob('libmv/multiview/*.cc')
src += env.Glob('libmv/numeric/*.cc') src += env.Glob('libmv/numeric/*.cc')
src += env.Glob('libmv/simple_pipeline/*.cc') src += env.Glob('libmv/simple_pipeline/*.cc')
src += env.Glob('libmv/tracking/*.cc') src += env.Glob('libmv/tracking/*.cc')
src += env.Glob('third_party/fast/*.c') src += env.Glob('third_party/fast/*.c')
src += env.Glob('third_party/gflags/*.cc') src += env.Glob('third_party/gflags/*.cc')
incs = '. ../Eigen3 third_party/ceres/include' incs = '. ../Eigen3 third_party/ceres/include'
incs += ' ' + env['BF_PNG_INC'] incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC'] incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): 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' incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes' 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/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/windows/port.cc']
else: else:
src += env.Glob("third_party/glog/src/*.cc") src += env.Glob("third_party/glog/src/*.cc")
incs += ' ./third_party/glog/src' incs += ' ./third_party/glog/src'
else:
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] ) 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'])

View File

@@ -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 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` 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/' | 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_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/' | 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_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/' | 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_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/' | 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="" src=""
win_src="" win_src=""
for x in $src_dir $src_third_dir; do for x in $src_dir $src_third_dir; do
@@ -59,12 +59,12 @@ for x in $src_dir $src_third_dir; do
fi fi
if stat $x/*.cpp > /dev/null 2>&1; then if stat $x/*.cpp > /dev/null 2>&1; then
t="src += env.Glob('`echo $x'/*.cpp'`')" t=" src += env.Glob('`echo $x'/*.cpp'`')"
fi fi
if stat $x/*.c > /dev/null 2>&1; then if stat $x/*.c > /dev/null 2>&1; then
if [ -z "$t" ]; then if [ -z "$t" ]; then
t="src += env.Glob('`echo $x'/*.c'`')" t=" src += env.Glob('`echo $x'/*.c'`')"
else else
t="$t + env.Glob('`echo $x'/*.c'`')" t="$t + env.Glob('`echo $x'/*.c'`')"
fi fi
@@ -72,7 +72,7 @@ for x in $src_dir $src_third_dir; do
if stat $x/*.cc > /dev/null 2>&1; then if stat $x/*.cc > /dev/null 2>&1; then
if [ -z "$t" ]; then if [ -z "$t" ]; then
t="src += env.Glob('`echo $x'/*.cc'`')" t=" src += env.Glob('`echo $x'/*.cc'`')"
else else
t="$t + env.Glob('`echo $x'/*.cc'`')" t="$t + env.Glob('`echo $x'/*.cc'`')"
fi fi
@@ -124,28 +124,39 @@ cat > CMakeLists.txt << EOF
set(INC set(INC
. .
third_party/ceres/include
)
set(INC_SYS
../Eigen3
\${PNG_INCLUDE_DIR}
\${ZLIB_INCLUDE_DIRS}
) )
set(SRC set(SRC
libmv-capi.cpp libmv-capi.h
)
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} ${sources}
${third_sources} ${third_sources}
libmv-capi.h
${headers} ${headers}
${third_headers} ${third_headers}
) )
if(WIN32) if(WIN32)
list(APPEND SRC list(APPEND SRC
third_party/glog/src/logging.cc third_party/glog/src/logging.cc
third_party/glog/src/raw_logging.cc third_party/glog/src/raw_logging.cc
@@ -181,7 +192,7 @@ if(WIN32)
third_party/msinttypes third_party/msinttypes
) )
endif() endif()
else() else()
list(APPEND SRC list(APPEND SRC
${third_glog_sources} ${third_glog_sources}
@@ -191,15 +202,22 @@ ${third_glog_headers}
list(APPEND INC list(APPEND INC
third_party/glog/src third_party/glog/src
) )
endif() endif()
add_definitions( add_definitions(
-DGOOGLE_GLOG_DLL_DECL= -DGOOGLE_GLOG_DLL_DECL=
) )
else()
list(APPEND SRC
libmv-capi_stub.cc
)
endif()
blender_add_lib(extern_libmv "\${SRC}" "\${INC}" "\${INC_SYS}") blender_add_lib(extern_libmv "\${SRC}" "\${INC}" "\${INC_SYS}")
add_subdirectory(third_party) if(WITH_LIBMV)
add_subdirectory(third_party)
endif()
EOF EOF
cat > SConscript << EOF cat > SConscript << EOF
@@ -216,27 +234,32 @@ Import('env')
defs = [] 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 $src
incs = '. ../Eigen3 third_party/ceres/include' incs = '. ../Eigen3 third_party/ceres/include'
incs += ' ' + env['BF_PNG_INC'] incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC'] incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): 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' incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
incs += ' ./third_party/msinttypes' incs += ' ./third_party/msinttypes'
${win_src} ${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/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/windows/port.cc']
else: else:
src += env.Glob("third_party/glog/src/*.cc") src += env.Glob("third_party/glog/src/*.cc")
incs += ' ./third_party/glog/src' incs += ' ./third_party/glog/src'
else:
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] ) 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 EOF

277
extern/libmv/libmv-capi_stub.cc vendored Normal file
View File

@@ -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

View File

@@ -44,6 +44,7 @@ set(INC
../../../intern/opennl/extern ../../../intern/opennl/extern
../../../intern/raskter ../../../intern/raskter
../../../intern/smoke/extern ../../../intern/smoke/extern
../../../extern/libmv
# XXX - BAD LEVEL CALL WM_api.h # XXX - BAD LEVEL CALL WM_api.h
../windowmanager ../windowmanager
@@ -412,9 +413,6 @@ if(WITH_GAMEENGINE)
endif() endif()
if(WITH_LIBMV) if(WITH_LIBMV)
list(APPEND INC
../../../extern/libmv
)
add_definitions(-DWITH_LIBMV) add_definitions(-DWITH_LIBMV)
endif() endif()

View File

@@ -50,6 +50,7 @@ incs += ' #/intern/mikktspace'
incs += ' #/intern/audaspace/intern' incs += ' #/intern/audaspace/intern'
incs += ' #/intern/ffmpeg' incs += ' #/intern/ffmpeg'
incs += ' #/intern/raskter' incs += ' #/intern/raskter'
incs += ' #/extern/libmv'
incs += ' ' + env['BF_OPENGL_INC'] incs += ' ' + env['BF_OPENGL_INC']
incs += ' ' + env['BF_ZLIB_INC'] incs += ' ' + env['BF_ZLIB_INC']
@@ -138,7 +139,6 @@ else:
sources.remove('intern' + os.sep + 'navmesh_conversion.c') sources.remove('intern' + os.sep + 'navmesh_conversion.c')
if env['WITH_BF_LIBMV']: if env['WITH_BF_LIBMV']:
incs += ' #/extern/libmv'
defs.append('WITH_LIBMV') defs.append('WITH_LIBMV')
if env['WITH_BF_FFTW3']: if env['WITH_BF_FFTW3']:

View File

@@ -64,11 +64,7 @@
#include "raskter.h" #include "raskter.h"
#ifdef WITH_LIBMV #include "libmv-capi.h"
# include "libmv-capi.h"
#else
struct libmv_Features;
#endif
typedef struct MovieDistortion { typedef struct MovieDistortion {
struct libmv_CameraIntrinsics *intrinsics; struct libmv_CameraIntrinsics *intrinsics;
@@ -343,7 +339,6 @@ static void get_search_origin_frame_pixel(int frame_width, int frame_height,
frame_pixel[1] = (int)frame_pixel[1]; frame_pixel[1] = (int)frame_pixel[1];
} }
#ifdef WITH_LIBMV
static void pixel_to_unified(int frame_width, int frame_height, const float pixel_coords[2], float unified_coords[2]) static void pixel_to_unified(int frame_width, int frame_height, const float pixel_coords[2], float unified_coords[2])
{ {
unified_coords[0] = pixel_coords[0] / frame_width; unified_coords[0] = pixel_coords[0] / frame_width;
@@ -438,7 +433,6 @@ static void set_marker_coords_from_tracking(int frame_width, int frame_height, M
marker->pos[0] += marker_unified[0]; marker->pos[0] += marker_unified[0];
marker->pos[1] += marker_unified[1]; marker->pos[1] += marker_unified[1];
} }
#endif
/*********************** clipboard *************************/ /*********************** clipboard *************************/
@@ -1540,7 +1534,6 @@ void BKE_tracking_camera_get_reconstructed_interpolate(MovieTracking *tracking,
/*********************** Distortion/Undistortion *************************/ /*********************** Distortion/Undistortion *************************/
#ifdef WITH_LIBMV
static void cameraIntrinscisOptionsFromTracking(libmv_cameraIntrinsicsOptions *camera_intrinsics_options, static void cameraIntrinscisOptionsFromTracking(libmv_cameraIntrinsicsOptions *camera_intrinsics_options,
MovieTracking *tracking, int calibration_width, int calibration_height) MovieTracking *tracking, int calibration_width, int calibration_height)
{ {
@@ -1559,7 +1552,6 @@ static void cameraIntrinscisOptionsFromTracking(libmv_cameraIntrinsicsOptions *c
camera_intrinsics_options->image_width = calibration_width; camera_intrinsics_options->image_width = calibration_width;
camera_intrinsics_options->image_height = (double) (calibration_height * aspy); camera_intrinsics_options->image_height = (double) (calibration_height * aspy);
} }
#endif
MovieDistortion *BKE_tracking_distortion_new(void) MovieDistortion *BKE_tracking_distortion_new(void)
{ {
@@ -1567,9 +1559,7 @@ MovieDistortion *BKE_tracking_distortion_new(void)
distortion = MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create"); distortion = MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create");
#ifdef WITH_LIBMV
distortion->intrinsics = libmv_CameraIntrinsicsNewEmpty(); distortion->intrinsics = libmv_CameraIntrinsicsNewEmpty();
#endif
return distortion; return distortion;
} }
@@ -1577,29 +1567,17 @@ MovieDistortion *BKE_tracking_distortion_new(void)
void BKE_tracking_distortion_update(MovieDistortion *distortion, MovieTracking *tracking, void BKE_tracking_distortion_update(MovieDistortion *distortion, MovieTracking *tracking,
int calibration_width, int calibration_height) int calibration_width, int calibration_height)
{ {
#ifdef WITH_LIBMV
libmv_cameraIntrinsicsOptions camera_intrinsics_options; libmv_cameraIntrinsicsOptions camera_intrinsics_options;
cameraIntrinscisOptionsFromTracking(&camera_intrinsics_options, tracking, cameraIntrinscisOptionsFromTracking(&camera_intrinsics_options, tracking,
calibration_width, calibration_height); calibration_width, calibration_height);
libmv_CameraIntrinsicsUpdate(distortion->intrinsics, &camera_intrinsics_options); libmv_CameraIntrinsicsUpdate(distortion->intrinsics, &camera_intrinsics_options);
#else
(void) distortion;
(void) tracking;
(void) calibration_width;
(void) calibration_height;
#endif
} }
void BKE_tracking_distortion_set_threads(MovieDistortion *distortion, int threads) void BKE_tracking_distortion_set_threads(MovieDistortion *distortion, int threads)
{ {
#ifdef WITH_LIBMV
libmv_CameraIntrinsicsSetThreads(distortion->intrinsics, threads); libmv_CameraIntrinsicsSetThreads(distortion->intrinsics, threads);
#else
(void) distortion;
(void) threads;
#endif
} }
MovieDistortion *BKE_tracking_distortion_copy(MovieDistortion *distortion) MovieDistortion *BKE_tracking_distortion_copy(MovieDistortion *distortion)
@@ -1608,11 +1586,7 @@ MovieDistortion *BKE_tracking_distortion_copy(MovieDistortion *distortion)
new_distortion = MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create"); new_distortion = MEM_callocN(sizeof(MovieDistortion), "BKE_tracking_distortion_create");
#ifdef WITH_LIBMV
new_distortion->intrinsics = libmv_CameraIntrinsicsCopy(distortion->intrinsics); new_distortion->intrinsics = libmv_CameraIntrinsicsCopy(distortion->intrinsics);
#else
(void) distortion;
#endif
return new_distortion; return new_distortion;
} }
@@ -1626,7 +1600,6 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
resibuf = IMB_dupImBuf(ibuf); resibuf = IMB_dupImBuf(ibuf);
#ifdef WITH_LIBMV
if (ibuf->rect_float) { if (ibuf->rect_float) {
if (undistort) { if (undistort) {
libmv_CameraIntrinsicsUndistortFloat(distortion->intrinsics, libmv_CameraIntrinsicsUndistortFloat(distortion->intrinsics,
@@ -1654,22 +1627,13 @@ ImBuf *BKE_tracking_distortion_exec(MovieDistortion *distortion, MovieTracking *
ibuf->x, ibuf->y, overscan, ibuf->channels); ibuf->x, ibuf->y, overscan, ibuf->channels);
} }
} }
#else
(void) overscan;
(void) undistort;
if (ibuf->rect_float && ibuf->rect)
imb_freerectImBuf(ibuf);
#endif
return resibuf; return resibuf;
} }
void BKE_tracking_distortion_free(MovieDistortion *distortion) void BKE_tracking_distortion_free(MovieDistortion *distortion)
{ {
#ifdef WITH_LIBMV
libmv_CameraIntrinsicsDestroy(distortion->intrinsics); libmv_CameraIntrinsicsDestroy(distortion->intrinsics);
#endif
MEM_freeN(distortion); MEM_freeN(distortion);
} }
@@ -1678,7 +1642,6 @@ void BKE_tracking_distort_v2(MovieTracking *tracking, const float co[2], float r
{ {
MovieTrackingCamera *camera = &tracking->camera; MovieTrackingCamera *camera = &tracking->camera;
#ifdef WITH_LIBMV
libmv_cameraIntrinsicsOptions camera_intrinsics_options; libmv_cameraIntrinsicsOptions camera_intrinsics_options;
double x, y; double x, y;
float aspy = 1.0f / tracking->camera.pixel_aspect; float aspy = 1.0f / tracking->camera.pixel_aspect;
@@ -1694,18 +1657,12 @@ void BKE_tracking_distort_v2(MovieTracking *tracking, const float co[2], float r
/* result is in image coords already */ /* result is in image coords already */
r_co[0] = x; r_co[0] = x;
r_co[1] = y; r_co[1] = y;
#else
(void) camera;
(void) co;
zero_v2(r_co);
#endif
} }
void BKE_tracking_undistort_v2(MovieTracking *tracking, const float co[2], float r_co[2]) void BKE_tracking_undistort_v2(MovieTracking *tracking, const float co[2], float r_co[2])
{ {
MovieTrackingCamera *camera = &tracking->camera; MovieTrackingCamera *camera = &tracking->camera;
#ifdef WITH_LIBMV
libmv_cameraIntrinsicsOptions camera_intrinsics_options; libmv_cameraIntrinsicsOptions camera_intrinsics_options;
double x = co[0], y = co[1]; double x = co[0], y = co[1];
float aspy = 1.0f / tracking->camera.pixel_aspect; float aspy = 1.0f / tracking->camera.pixel_aspect;
@@ -1716,11 +1673,6 @@ void BKE_tracking_undistort_v2(MovieTracking *tracking, const float co[2], float
r_co[0] = (float)x * camera->focal + camera->principal[0]; r_co[0] = (float)x * camera->focal + camera->principal[0];
r_co[1] = (float)y * camera->focal + camera->principal[1] * aspy; r_co[1] = (float)y * camera->focal + camera->principal[1] * aspy;
#else
(void) camera;
(void) co;
zero_v2(r_co);
#endif
} }
ImBuf *BKE_tracking_undistort_frame(MovieTracking *tracking, ImBuf *ibuf, int calibration_width, ImBuf *BKE_tracking_undistort_frame(MovieTracking *tracking, ImBuf *ibuf, int calibration_width,
@@ -1822,7 +1774,6 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *sea
int from_anchor, int use_mask, int num_samples_x, int num_samples_y, int from_anchor, int use_mask, int num_samples_x, int num_samples_y,
float pos[2]) float pos[2])
{ {
#ifdef WITH_LIBMV
ImBuf *pattern_ibuf; ImBuf *pattern_ibuf;
double src_pixel_x[5], src_pixel_y[5]; double src_pixel_x[5], src_pixel_y[5];
double warped_position_x, warped_position_y; double warped_position_x, warped_position_y;
@@ -1880,30 +1831,6 @@ ImBuf *BKE_tracking_sample_pattern(int frame_width, int frame_height, ImBuf *sea
} }
return pattern_ibuf; return pattern_ibuf;
#else
ImBuf *pattern_ibuf;
/* real sampling requires libmv, but areas are supposing pattern would be
* sampled if search area does exists, so we'll need to create empty
* pattern area here to prevent adding NULL-checks all over just to deal
* with situation when libmv is disabled
*/
(void) frame_width;
(void) frame_height;
(void) search_ibuf;
(void) marker;
(void) from_anchor;
(void) track;
(void) use_mask;
pattern_ibuf = IMB_allocImBuf(num_samples_x, num_samples_y, 32, IB_rectfloat);
pos[0] = num_samples_x / 2.0f;
pos[1] = num_samples_y / 2.0f;
return pattern_ibuf;
#endif
} }
ImBuf *BKE_tracking_get_pattern_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker, ImBuf *BKE_tracking_get_pattern_imbuf(ImBuf *ibuf, MovieTrackingTrack *track, MovieTrackingMarker *marker,
@@ -2232,7 +2159,6 @@ static void tracks_map_free(TracksMap *map, void (*customdata_free)(void *custom
/*********************** 2D tracking *************************/ /*********************** 2D tracking *************************/
typedef struct TrackContext { typedef struct TrackContext {
#ifdef WITH_LIBMV
/* the reference marker and cutout search area */ /* the reference marker and cutout search area */
MovieTrackingMarker reference_marker; MovieTrackingMarker reference_marker;
@@ -2243,9 +2169,6 @@ typedef struct TrackContext {
int framenr; int framenr;
float *mask; float *mask;
#else
int pad;
#endif
} TrackContext; } TrackContext;
typedef struct MovieTrackingContext { typedef struct MovieTrackingContext {
@@ -2267,16 +2190,11 @@ static void track_context_free(void *customdata)
{ {
TrackContext *track_context = (TrackContext *)customdata; TrackContext *track_context = (TrackContext *)customdata;
#ifdef WITH_LIBMV
if (track_context->search_area) if (track_context->search_area)
MEM_freeN(track_context->search_area); MEM_freeN(track_context->search_area);
if (track_context->mask) if (track_context->mask)
MEM_freeN(track_context->mask); MEM_freeN(track_context->mask);
#else
(void)track_context;
#endif
} }
/* Create context for motion 2D tracking, copies all data needed /* Create context for motion 2D tracking, copies all data needed
@@ -2402,7 +2320,6 @@ void BKE_tracking_context_sync_user(const MovieTrackingContext *context, MovieCl
user->framenr = context->sync_frame; user->framenr = context->sync_frame;
} }
#ifdef WITH_LIBMV
/* **** utility functions for tracking **** */ /* **** utility functions for tracking **** */
/* convert from float and byte RGBA to grayscale. Supports different coefficients for RGB. */ /* convert from float and byte RGBA to grayscale. Supports different coefficients for RGB. */
@@ -2778,7 +2695,6 @@ static bool configure_and_run_tracker(ImBuf *destination_ibuf, MovieTrackingTrac
return tracked; return tracked;
} }
#endif
/* Track all the tracks from context one more frame, /* Track all the tracks from context one more frame,
* returns FALSe if nothing was tracked. * returns FALSe if nothing was tracked.
@@ -2821,7 +2737,6 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
marker = BKE_tracking_marker_get_exact(track, curfra); marker = BKE_tracking_marker_get_exact(track, curfra);
if (marker && (marker->flag & MARKER_DISABLED) == 0) { if (marker && (marker->flag & MARKER_DISABLED) == 0) {
#ifdef WITH_LIBMV
bool tracked = false, need_readjust; bool tracked = false, need_readjust;
double dst_pixel_x[5], dst_pixel_y[5]; double dst_pixel_x[5], dst_pixel_y[5];
@@ -2857,10 +2772,6 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
} }
ok = true; ok = true;
#else
(void)frame_height;
(void)frame_width;
#endif
} }
} }
@@ -2879,7 +2790,6 @@ int BKE_tracking_context_step(MovieTrackingContext *context)
*/ */
void BKE_tracking_refine_marker(MovieClip *clip, MovieTrackingTrack *track, MovieTrackingMarker *marker, int backwards) void BKE_tracking_refine_marker(MovieClip *clip, MovieTrackingTrack *track, MovieTrackingMarker *marker, int backwards)
{ {
#ifdef WITH_LIBMV
MovieTrackingMarker *reference_marker = NULL; MovieTrackingMarker *reference_marker = NULL;
ImBuf *reference_ibuf, *destination_ibuf; ImBuf *reference_ibuf, *destination_ibuf;
float *search_area, *mask = NULL; float *search_area, *mask = NULL;
@@ -2941,24 +2851,17 @@ void BKE_tracking_refine_marker(MovieClip *clip, MovieTrackingTrack *track, Movi
MEM_freeN(mask); MEM_freeN(mask);
IMB_freeImBuf(reference_ibuf); IMB_freeImBuf(reference_ibuf);
IMB_freeImBuf(destination_ibuf); IMB_freeImBuf(destination_ibuf);
#else
(void) clip;
(void) track;
(void) marker;
(void) backwards;
#endif
} }
/*********************** Camera solving *************************/ /*********************** Camera solving *************************/
typedef struct MovieReconstructContext { typedef struct MovieReconstructContext {
#ifdef WITH_LIBMV
struct libmv_Tracks *tracks; struct libmv_Tracks *tracks;
int keyframe1, keyframe2; int keyframe1, keyframe2;
short refine_flags; short refine_flags;
struct libmv_Reconstruction *reconstruction; struct libmv_Reconstruction *reconstruction;
#endif
char object_name[MAX_NAME]; char object_name[MAX_NAME];
int is_camera; int is_camera;
short motion_flag; short motion_flag;
@@ -2987,7 +2890,6 @@ typedef struct ReconstructProgressData {
int message_size; int message_size;
} ReconstructProgressData; } ReconstructProgressData;
#ifdef WITH_LIBMV
/* Create mew libmv Tracks structure from blender's tracks list. */ /* Create mew libmv Tracks structure from blender's tracks list. */
static struct libmv_Tracks *libmv_tracks_new(ListBase *tracksbase, int width, int height) static struct libmv_Tracks *libmv_tracks_new(ListBase *tracksbase, int width, int height)
{ {
@@ -3219,13 +3121,11 @@ static int reconstruct_count_tracks_on_both_keyframes(MovieTracking *tracking, M
return tot; return tot;
} }
#endif
/* Perform early check on whether everything is fine to start reconstruction. */ /* Perform early check on whether everything is fine to start reconstruction. */
int BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObject *object, int BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObject *object,
char *error_msg, int error_size) char *error_msg, int error_size)
{ {
#ifdef WITH_LIBMV
if (tracking->settings.motion_flag & TRACKING_MOTION_MODAL) { if (tracking->settings.motion_flag & TRACKING_MOTION_MODAL) {
/* TODO: check for number of tracks? */ /* TODO: check for number of tracks? */
return TRUE; return TRUE;
@@ -3238,15 +3138,12 @@ int BKE_tracking_reconstruction_check(MovieTracking *tracking, MovieTrackingObje
return FALSE; return FALSE;
} }
return TRUE; #ifndef WITH_LIBMV
#else
BLI_strncpy(error_msg, N_("Blender is compiled without motion tracking library"), error_size); BLI_strncpy(error_msg, N_("Blender is compiled without motion tracking library"), error_size);
return FALSE;
(void) tracking;
(void) object;
return 0;
#endif #endif
return TRUE;
} }
/* Create context for camera/object motion reconstruction. /* Create context for camera/object motion reconstruction.
@@ -3317,17 +3214,10 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieTracking *
context->sfra = sfra; context->sfra = sfra;
context->efra = efra; context->efra = efra;
#ifdef WITH_LIBMV
context->tracks = libmv_tracks_new(tracksbase, width, height * aspy); context->tracks = libmv_tracks_new(tracksbase, width, height * aspy);
context->keyframe1 = keyframe1; context->keyframe1 = keyframe1;
context->keyframe2 = keyframe2; context->keyframe2 = keyframe2;
context->refine_flags = reconstruct_refine_intrinsics_get_flags(tracking, object); context->refine_flags = reconstruct_refine_intrinsics_get_flags(tracking, object);
#else
(void) width;
(void) height;
(void) keyframe1;
(void) keyframe2;
#endif
return context; return context;
} }
@@ -3335,19 +3225,16 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieTracking *
/* Free memory used by a reconstruction process. */ /* Free memory used by a reconstruction process. */
void BKE_tracking_reconstruction_context_free(MovieReconstructContext *context) void BKE_tracking_reconstruction_context_free(MovieReconstructContext *context)
{ {
#ifdef WITH_LIBMV
if (context->reconstruction) if (context->reconstruction)
libmv_destroyReconstruction(context->reconstruction); libmv_destroyReconstruction(context->reconstruction);
libmv_tracksDestroy(context->tracks); libmv_tracksDestroy(context->tracks);
#endif
tracks_map_free(context->tracks_map, NULL); tracks_map_free(context->tracks_map, NULL);
MEM_freeN(context); MEM_freeN(context);
} }
#ifdef WITH_LIBMV
/* Callback which is called from libmv side to update progress in the interface. */ /* Callback which is called from libmv side to update progress in the interface. */
static void reconstruct_update_solve_cb(void *customdata, double progress, const char *message) static void reconstruct_update_solve_cb(void *customdata, double progress, const char *message)
{ {
@@ -3390,7 +3277,6 @@ static void reconstructionOptionsFromContext(libmv_reconstructionOptions *recons
reconstruction_options->success_threshold = context->success_threshold; reconstruction_options->success_threshold = context->success_threshold;
reconstruction_options->use_fallback_reconstruction = context->use_fallback_reconstruction; reconstruction_options->use_fallback_reconstruction = context->use_fallback_reconstruction;
} }
#endif
/* Solve camera/object motion and reconstruct 3D markers position /* Solve camera/object motion and reconstruct 3D markers position
* from a prepared reconstruction context. * from a prepared reconstruction context.
@@ -3404,7 +3290,6 @@ static void reconstructionOptionsFromContext(libmv_reconstructionOptions *recons
void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short *stop, short *do_update, void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short *stop, short *do_update,
float *progress, char *stats_message, int message_size) float *progress, char *stats_message, int message_size)
{ {
#ifdef WITH_LIBMV
float error; float error;
ReconstructProgressData progressdata; ReconstructProgressData progressdata;
@@ -3437,14 +3322,6 @@ void BKE_tracking_reconstruction_solve(MovieReconstructContext *context, short *
error = libmv_reprojectionError(context->reconstruction); error = libmv_reprojectionError(context->reconstruction);
context->reprojection_error = error; context->reprojection_error = error;
#else
(void) context;
(void) stop;
(void) do_update;
(void) progress;
(void) stats_message;
(void) message_size;
#endif
} }
/* Finish reconstruction process by copying reconstructed data /* Finish reconstruction process by copying reconstructed data
@@ -3470,17 +3347,14 @@ int BKE_tracking_reconstruction_finish(MovieReconstructContext *context, MovieTr
reconstruction->error = context->reprojection_error; reconstruction->error = context->reprojection_error;
reconstruction->flag |= TRACKING_RECONSTRUCTED; reconstruction->flag |= TRACKING_RECONSTRUCTED;
#ifdef WITH_LIBMV
if (!reconstruct_retrieve_libmv(context, tracking)) if (!reconstruct_retrieve_libmv(context, tracking))
return FALSE; return FALSE;
#endif
return TRUE; return TRUE;
} }
/*********************** Feature detection *************************/ /*********************** Feature detection *************************/
#ifdef WITH_LIBMV
/* Check whether point is inside grease pencil stroke. */ /* Check whether point is inside grease pencil stroke. */
static bool check_point_in_stroke(bGPDstroke *stroke, float x, float y) static bool check_point_in_stroke(bGPDstroke *stroke, float x, float y)
{ {
@@ -3594,14 +3468,12 @@ static unsigned char *detect_get_frame_ucharbuf(ImBuf *ibuf)
return pixels; return pixels;
} }
#endif
/* Detect features using FAST detector */ /* Detect features using FAST detector */
void BKE_tracking_detect_fast(MovieTracking *tracking, ListBase *tracksbase, ImBuf *ibuf, void BKE_tracking_detect_fast(MovieTracking *tracking, ListBase *tracksbase, ImBuf *ibuf,
int framenr, int margin, int min_trackness, int min_distance, bGPDlayer *layer, int framenr, int margin, int min_trackness, int min_distance, bGPDlayer *layer,
int place_outside_layer) int place_outside_layer)
{ {
#ifdef WITH_LIBMV
struct libmv_Features *features; struct libmv_Features *features;
unsigned char *pixels = detect_get_frame_ucharbuf(ibuf); unsigned char *pixels = detect_get_frame_ucharbuf(ibuf);
@@ -3615,17 +3487,6 @@ void BKE_tracking_detect_fast(MovieTracking *tracking, ListBase *tracksbase, ImB
place_outside_layer ? true : false); place_outside_layer ? true : false);
libmv_destroyFeatures(features); libmv_destroyFeatures(features);
#else
(void) tracking;
(void) tracksbase;
(void) ibuf;
(void) framenr;
(void) margin;
(void) min_trackness;
(void) min_distance;
(void) layer;
(void) place_outside_layer;
#endif
} }
/*********************** 2D stabilization *************************/ /*********************** 2D stabilization *************************/

View File

@@ -151,6 +151,7 @@ endif()
bf_intern_opennl bf_intern_opennl
extern_rangetree extern_rangetree
extern_wcwidth extern_wcwidth
extern_libmv
) )
if(WITH_MOD_CLOTH_ELTOPO) if(WITH_MOD_CLOTH_ELTOPO)
@@ -166,7 +167,6 @@ endif()
endif() endif()
if(WITH_LIBMV) if(WITH_LIBMV)
list(APPEND BLENDER_SORTED_LIBS extern_libmv)
list(APPEND BLENDER_SORTED_LIBS extern_ceres) list(APPEND BLENDER_SORTED_LIBS extern_ceres)
endif() endif()

View File

@@ -932,6 +932,7 @@ endif()
bf_intern_opencolorio bf_intern_opencolorio
extern_rangetree extern_rangetree
extern_wcwidth extern_wcwidth
extern_libmv
) )
if(WITH_COMPOSITOR) if(WITH_COMPOSITOR)
@@ -941,7 +942,6 @@ endif()
endif() endif()
if(WITH_LIBMV) if(WITH_LIBMV)
list(APPEND BLENDER_SORTED_LIBS extern_libmv)
list(APPEND BLENDER_SORTED_LIBS extern_ceres) list(APPEND BLENDER_SORTED_LIBS extern_ceres)
endif() endif()