我在构建 OpenCV 3 和贡献 matlab 模块时遇到问题,
我使用以下方法构建它:
cmake -D MATLAB_ROOT_DIR=/usr/local/MATLAB/R2014a/bin -DOPENCV_EXTRA_MODULES_PATH=/home/me/OpenCV/opencv/opencv_contrib-master/modules /home/me/OpenCV/opencv -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..
但是,它失败了一些模块,包括 matlab,这是我目前需要的。
虽然它确实找到了 mex,但它不会生成/构建并在 Unavailable 模块下显示它。
我很欣赏关于可能是什么原因以及如何解决它的任何想法。谢谢!
Matlab:
-- mex: /usr/local/MATLAB/R2014a/bin/mex
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
-- Found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.6", minimum required is "2.7")
-- Found PythonInterp: /usr/bin/python3.4 (found suitable version "3.4", minimum required is "3.4")
-- Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS) (found suitable exact version "3.4.0")
-- Could NOT find Matlab (missing: MATLAB_ARCH)
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
最佳答案
来自 https://github.com/Itseez/opencv/blob/master/cmake/OpenCVFindMatlab.cmake我不认为MATLAB_ROOT_DIR
应包含 /bin
因为他们在第 139 行做 ${MATLAB_ROOT_DIR}/bin
您也不需要设置 MATLAB_ROOT_DIR
完全没有,因为该脚本在第 63 行使用 set(SEARCH_DIRS_ /Applications /usr/local /opt/local /usr /opt)
显式检查了 matlab 的/usr/local。
关于matlab - OpenCV 3 与贡献 matlab 模块构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31575183/