问题
I am trying to build opencv with sfm modules I've built and installed gflags then glog and the ceres-solver. Yet the make logs says: Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags. Even though in earlier lines it says it finds both to these directories.
I've also built and installed VTK though for some reason it doesn't find it even when I manually select the build directory.
Below is the relevant section of my CMake log:
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
OpenCV Python: during development append to PYTHONPATH: C:/DEV/opencv-4.2.0/builds/python_loader
Caffe: NO
Protobuf: NO
Glog: YES
freetype2: NO
harfbuzz: NO
Module opencv_ovis disabled because OGRE3D was not found
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.
Found installed version of gflags: C:/Program Files (x86)/gflags/lib/cmake/gflags
Detected gflags version: 2.2.2
Checking SFM deps... FALSE
Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
回答1:
I managed to get the SFM module to compile finally. I am not 100% on what fixed it but here is what I did: I deleted all versions of gflags, glog, and ceres-solver. I downloaded a slightly older version of ceres-solver (1.14) and VTK (8.2.0). The earlier versions might be related to using opencv4.2 and python 3.7.
I placed gflags and glog in the ceres-solver folder with eigen. Then using CMake and visual studio 2019 I built and installed gflags in debug and release. glog (linking to gflags) only in release. Finally, I built and installed ceres-solver linking to glog, gflags and eigen. Following this tutorial: http://sylvain.duchene.im/how-to-build-ceres-under-windows/
Then when I used CMake to build openCV4.2 with the contribs libraries I found both the sfm module and VTK.
来源:https://stackoverflow.com/questions/62374063/building-opencv-with-sfm-module-issues