I try to install the openMVG from source by using make
and make install
. After that, I write the CMakeLists file like the following to link the library.
cmake_minimum_required(VERSION 3.0)
find_package(OpenMVG REQUIRED)
include_directories(${OPENMVG_INCLUDE_DIRS})
add_executable(test main.cpp)
target_link_libraries(test ${OPENMVG_LIBRARIES})
The cmake log information is as the following.
-- The C compiler identification is AppleClang 10.0.0.10001145
-- The CXX compiler identification is AppleClang 10.0.0.10001145
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- ----
-- OpenMVG Find_Package
-- ----
-- Found OpenMVG version: 1.4.0
-- Installed in: /usr/local
-- ----
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/zsk/Downloads/programming/test_openmvg/build
My code is as the following.
#include <iostream>
#include <openMVG/numeric/numeric.h>
int main()
{
Mat2X xy ( 2 , 5);
// Defines some data points
xy << 1, 2, 3, 4, 5, // x
3, 5, 7, 9, 11; // y
// The base model estimator and associated error metric
LineKernel kernel ( xy );
// Call the Max-Consensus routine
std::vector<uint32_t> vec_inliers;
Vec2 model = MaxConsensus ( kernel , ScorerEvaluator<LineKernel >(0.3) , &-vec_inliers );
std::cout << "Finish " << std::endl;
return 0;
}
I make sure I install the openMVG successfully. I am not very familiar with the compilation of C++ program. It is very strange that I get the following error.
/Users/zsk/Downloads/programming/test_openmvg/main.cpp:2:10: fatal error:
'openMVG/numeric/numeric.h' file not found
#include <openMVG/numeric/numeric.h>
Aucun commentaire:
Enregistrer un commentaire