Closed xialang2012 closed 8 years ago
Many people have made the small modifications needed to run Theia on Windows. But since I do not have access to a windows development environment, I cannot guarantee support for Windows. However, if you submit fixes that allow the library to be more friendly to Windows, I will gladly merge them into the main repo!
Ok, thank you.
I faced some errors when I built it on Ubuntu14.04.
xl@ubuntu:~/TheiaSfM/build$ make [ 0%] Built target gtest ... In file included from /usr/include/eigen3/Eigen/Core:368:0, from /home/xl/TheiaSfM/src/theia/image/image.h:38, from /home/xl/TheiaSfM/src/theia/image/image.cc:35: /usr/include/eigen3/Eigen/src/Core/GlobalFunctions.h:50:3: note: ‘Eigen::abs’ EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs,scalar_abs_op) ^ In file included from /usr/include/boost/ratio/ratio.hpp:36:0, from /usr/include/boost/chrono/duration.hpp:41, from /usr/include/boost/chrono/time_point.hpp:33, from /usr/include/boost/thread/lock_types.hpp:22, from /usr/include/boost/thread/pthread/thread_data.hpp:12, from /usr/include/boost/thread/thread_only.hpp:17, from /usr/include/boost/thread/thread.hpp:12, from /usr/include/boost/thread.hpp:13, from /usr/include/OpenImageIO/thread.h:64, from /usr/include/OpenImageIO/imagebufalgo.h:45, from /home/xl/TheiaSfM/src/theia/image/image.cc:40: /usr/include/boost/ratio/detail/mpl/abs.hpp:44:8: note: ‘boost::mpl::abs’ struct abs ^ make[2]: * [src/theia/CMakeFiles/theia.dir/image/image.cc.o] Error 1 make[1]: * [src/theia/CMakeFiles/theia.dir/all] Error 2 make: *\ [all] Error 2
It seems that I have a low version of OpenImageIO?
I used the OpenImageIO 1.5.24, it still could not pass the build step.
/home/xl/TheiaSfM/src/theia/image/image.cc:107:10: error: ‘class OpenImageIO::v1_5::ImageBuf’ has no member named ‘setpixels’ image.set_pixels(roi, OpenImageIO::TypeDesc::FLOAT, &value); ^ /home/xl/TheiaSfM/src/theia/image/image.cc: In member function ‘theia::FloatImage theia::FloatImage::ComputeGradient() const’: /home/xl/TheiaSfM/src/theia/image/image.cc:264:3: error: ‘abs’ is not a member of ‘OpenImageIO::v1_5::ImageBufAlgo’ OpenImageIO::ImageBufAlgo::abs(gradient_x, gradient_x);
It works well on the version of 1.6.17 for OpenImageIO. But I have a new problem
Building CXX object src/theia/CMakeFiles/theia.dir/util/timer.cc.o /home/xl/TheiaSfM/src/theia/util/random.cc:47:41: error: missing binary operator before token "("
if defined(clang) && !__has_feature(cxx_thread_local)
^
make[2]: * [src/theia/CMakeFiles/theia.dir/util/random.cc.o] Error 1 make[2]: * Waiting for unfinished jobs.... make[1]: * [src/theia/CMakeFiles/theia.dir/all] Error 2 make: * [all] Error 2
As for the OpenImageIO errors -- I am working on a fix that should hopefully be able to work with version 1.3 since that seems to be the version most people install.
The second error is more curious... It must be related to windows compilation because I do not get that error for Mac OS X or Ubuntu 14.04. I will look into it.
It is odd to me that your line 47 in random.cc does not match the source input. Can you confirm you are using the master branch?
Here is the source input, which has "clang" instead of what your compiler is showing "clang" https://github.com/sweeneychris/TheiaSfM/blob/f05b8283b4431727e6a49b721cc7927f1276dab0/src/theia/util/random.cc#L47
Oh nevermind, the output you provided is due to github bolding the text when you use two underscores!
I have tried it again, the whole commands I used to built it as below
git clone https://github.com/sweeneychris/TheiaSfM.git
cd TheiaSfM/
mkdir built && cd built/ && cmake ..
-- The C compiler identification is GNU 4.8.4 -- The CXX compiler identification is GNU 4.8.4 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Eigen: /usr/include/eigen3 (found suitable version "3.2.0", minimum required is "3.2.0") -- Found Eigen version 3.2.0: /usr/include/eigen3 -- No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available. -- Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake. -- Found exported gflags build directory: /home/xl/odm-new/odm-mvs/OpenDroneMap/SuperBuild/build/gflags -- Detected broken gflags install in: /home/xl/odm-new/odm-mvs/OpenDroneMap/SuperBuild/build/gflags, version: 2.1.2 <= 2.1.2 which defines gflags_LIBRARIES = gflags which is not an imported CMake target, see: https://github.com/gflags/gflags/issues/110. Attempting to fix by detecting correct gflags target. -- Found valid gflags target: gflags-static, updating gflags_LIBRARIES. -- Detected gflags version: 2.1.2 -- Found Gflags: /home/xl/odm-new/odm-mvs/OpenDroneMap/SuperBuild/build/gflags/include
-- Found Google Flags: /home/xl/odm-new/odm-mvs/OpenDroneMap/SuperBuild/build/gflags/include in namespace: google -- Check for Google Log -- Found Glog: /usr/include
-- Found Google Logging: /usr/include -- Check for Ceres -- Found required Ceres dependency: Eigen version 3.2.0 in /usr/include/eigen3 -- Found required Ceres dependency: Glog in /usr/include -- Found Ceres version: 1.10.0 installed in: /usr/local -- Found Ceres: /usr/local/include;/usr/include/eigen3;/usr/include -- Check for OpenImageIO -- Found OpenImageIO: /usr/local/include
-- Found OpenImageIO: /usr/local/include -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- A library with BLAS API found. -- Found AMD library: /usr/lib/x86_64-linux-gnu/libamd.so -- Found AMD header in: /usr/include/suitesparse -- Found CAMD library: /usr/lib/x86_64-linux-gnu/libcamd.so -- Found CAMD header in: /usr/include/suitesparse -- Found COLAMD library: /usr/lib/x86_64-linux-gnu/libcolamd.so -- Found COLAMD header in: /usr/include/suitesparse -- Found CCOLAMD library: /usr/lib/x86_64-linux-gnu/libccolamd.so -- Found CCOLAMD header in: /usr/include/suitesparse -- Found CHOLMOD library: /usr/lib/x86_64-linux-gnu/libcholmod.so -- Found CHOLMOD header in: /usr/include/suitesparse -- Found SuiteSparseQR library: /usr/lib/x86_64-linux-gnu/libspqr.so -- Found SuiteSparseQR header in: /usr/include/suitesparse -- Found Intel Thread Building Blocks (TBB) library: /usr/lib/libtbb.so, assuming SuiteSparseQR was compiled with TBB. -- Found Intel Thread Building Blocks (TBB) Malloc library: /usr/lib/libtbbmalloc.so -- Found SuiteSparse_config library: /usr/lib/x86_64-linux-gnu/libsuitesparseconfig.a -- Found SuiteSparse_config header in: /usr/include/suitesparse -- Adding librt: /usr/lib/x86_64-linux-gnu/librt.so to SuiteSparse_config libraries (required on Linux & Unix [not OSX] if SuiteSparse is compiled with timing). -- Did not find METIS library (optional SuiteSparse dependency) -- Found SuiteSparse: TRUE (found version "4.2.1") -- Found SuiteSparse 4.2.1 -- Found PythonInterp: /usr/bin/python (found version "2.7.6") -- Found Eigen: /usr/include/eigen3 (found version "3.2.0") -- Found Eigen version 3.2.0: /usr/include/eigen3 -- Building with OpenMP. -- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so
-- Building with OpenMP. -- No build type specified; defaulting to CMAKE_BUILD_TYPE=Release. -- Performing Test COMPILER_HAS_CXX11_FLAG -- Performing Test COMPILER_HAS_CXX11_FLAG - Success -- Found HDF5: /usr/lib/x86_64-linux-gnu/libhdf5.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_MAIN_LIBRARY) CMake Warning at libraries/flann/CMakeLists.txt:116 (message): gtest library not found, some tests will not be run-- Found OpenMP: -fopenmp
-- Install prefix: /usr/local -- Build type: Release -- Building C bindings: OFF -- Building examples: OFF -- Building tests: OFF -- Building documentation: OFF -- Building python bindings: OFF -- Building matlab bindings: OFF -- Building CUDA library: OFF -- Using OpenMP support: ON -- Using MPI support: OFF -- CMAKE_CXX_FLAGS: -std=c++11 -- Found Eigen version 3.2.0: /usr/include/eigen3 -- CMAKE_CXX_FLAGS: -std=c++11 -- Default Install prefix: /usr/local/ -- Found Eigen version 3.2.0: /usr/include/eigen3 -- Found installed version of gflags: /home/xl/odm-new/odm-mvs/OpenDroneMap/SuperBuild/build/gflags -- Detected broken gflags install in: /home/xl/odm-new/odm-mvs/OpenDroneMap/SuperBuild/build/gflags, version: 2.1.2 <= 2.1.2 which defines gflags_LIBRARIES = gflags which is not an imported CMake target, see: https://github.com/gflags/gflags/issues/110. Attempting to fix by detecting correct gflags target. -- Found valid gflags target: gflags-static, updating gflags_LIBRARIES. -- Detected gflags version: 2.1.2 -- Check for Google ceres-solver -- Found required Ceres dependency: Eigen version 3.2.0 in /usr/include/eigen3 -- Found required Ceres dependency: Glog in /usr/include -- Found Ceres version: 1.10.0 installed in: /usr/local -- Found Ceres headers in: /usr/local/include;/usr/include/eigen3;/usr/include -- A library with BLAS API found. -- A library with BLAS API found. -- A library with LAPACK API found. -- Check for Optimo -- Found optimo headers: /home/xl/TheiaSfM/libraries/optimo -- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so
-- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so
-- Found GLUT: /usr/include -- Configuring done -- Generating done -- Build files have been written to: /home/xl/TheiaSfM/built
make -j10
.... [ 42%] Building CXX object src/theia/CMakeFiles/theia.dir/util/random.cc.o [ 42%] Building CXX object src/theia/CMakeFiles/theia.dir/util/stringprintf.cc.o /home/xl/TheiaSfM/src/theia/util/random.cc:47:41: error: missing binary operator before token "("
if defined(clang) && !__has_feature(cxx_thread_local)
^
[ 43%] Building CXX object src/theia/CMakeFiles/theia.dir/util/threadpool.cc.o make[2]: * [src/theia/CMakeFiles/theia.dir/util/random.cc.o] Error 1 make[2]: * Waiting for unfinished jobs.... make[1]: * [src/theia/CMakeFiles/theia.dir/all] Error 2 make: * [all] Error 2
If there are some errors about the libraries dependence?
For now, the master does not work well, but the release of V0.6 is ok https://github.com/sweeneychris/TheiaSfM/archive/v0.6.zip.
I have a problem about run the build_reconstruction
I0920 20:57:41.574055 44504 feature_extractor_and_matcher.cc:194] Image /home/xl/open/images/dj-hl/images/dji_0066.jpg did not contain an EXIF focal length. Skipping this image. I0920 20:57:41.677264 44506 feature_extractor_and_matcher.cc:194] Image /home/xl/open/images/dj-hl/images/dji_0080.jpg did not contain an EXIF focal length. Skipping this image. ..... I0920 20:57:47.459628 44504 feature_extractor_and_matcher.cc:194] Image /home/xl/open/images/dj-hl/images/dji_0070.jpg did not contain an EXIF focal length. Skipping this image. I0920 20:57:47.460171 44498 feature_extractor_and_matcher.cc:160] Matching images... F0920 20:57:47.460316 44498 threadpool.cc:82] Check failed: num_threads >= 1 (0 vs. 1) The number of threads specified to the ThreadPool is insufficient. * Check failure stack trace: * @ 0x7fcaeb8badaa (unknown) @ 0x7fcaeb8bace4 (unknown) @ 0x7fcaeb8ba6e6 (unknown) @ 0x7fcaeb8bd687 (unknown) @ 0x4bbdb5 theia::ThreadPool::ThreadPool() @ 0x521966 theia::FeatureMatcher<>::MatchImagesWithGeometricVerification() @ 0x4d2d39 theia::FeatureExtractorAndMatcher::ExtractAndMatchFeatures() @ 0x49da13 theia::ReconstructionBuilder::ExtractAndMatchFeatures() @ 0x48f804 AddImagesToReconstructionBuilder() @ 0x48c9ef main @ 0x7fcae95fff45 (unknown) @ 0x48e937 (unknown) @ (nil) (unknown) Aborted (core dumped)
It seems TheiaSfM failed to read the EXIF correctly, but I can separately run extract_features
, match_features
well, except match_features
shows some messages
xl@ubuntu:~/TheiaSfM-0.6/build$ ./bin/match_features --input_features=/home/xl/TheiaSfM-0.6/build/*.features --output_matches_file=/home/xl/TheiaSfM-0.6/build/mat --num_threads=8 --lowes_ratio=0.8 E0920 21:07:56.648465 44666 read_calibration.cc:52] Cannot read the list file from
For current master:
1 comment out the random.cc, it can pass
// Define the random engine to be thread-local if available. Otherwise the
// random generator is not thread safe but this should not cause severe errors.
//#if defined (__clang__) && !__has_feature (cxx_thread_local)
//static std::mt19937 util_generator;
//#else
thread_local std::mt19937 util_generator;
//#endif
2 build_reconstruction
still shows the same errors
3 the document
./bin/extract_features --input_images=/path/to/images/*.jpg --features_output_director=/path/to/output --num_threads=4 --descriptor=SIFT --logtostderr
--features_output_director
should be --features_output_directory
./bin/match_features --input_features=/path/to/features/*.features --output_matches_file=/path/to/output --num_threads=4 --matcher=CASCADE_HASHING --lowes_ratio=0.8 --logtostderr --v=1
should be
./bin/compute_two_view_geometry --images=/path/to/features/*.features --output_matches_file=/path/to/output --num_threads=4 --lowes_ratio=0.8 --logtostderr --v=1
I just submitted a patch to try and fix the random.cc error. Could you sync to the master branch and let me know if this works?
The patch works well. The flags.txt file config.txt
Awesome that the patch works.
Two things about the config.txt file you've sent. First, you should upgrade that file to the one found in the master branch. There are a few new flags that have changed. Second, you have the option --only_calibrated_views=true but Theia cannot find any calibrated views (i.e. ones with EXIF focal length info) in your dataset. So you'll want to set that flag to false for your dataset in order for it to run.
Ok, Thank you for your help, It works well.
vcpkg: C++ Package Manager for Windows https://docs.microsoft.com/en-us/cpp/vcpkg
vcpkg makes it easy to install open software (using some libraries) written by C++. Theia is included in vcpkg package (it is installable). https://github.com/Microsoft/vcpkg/tree/master/ports/theia
With Visual Studio 2015 (Update 3) and 2017 only, Windows users can easily use Theia.
Does the TheiaSfM support to run on Windows?