在Raspberry Pi中配置OpenCV时,使用Protobuf库获取CMake错误

时间:2018-03-22 20:32:05

标签: opencv raspberry-pi

我按照this教程安装OpenCV,所有步骤一直有效,直到我到达安装部分。我做了以下事情:

mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_C_EXAMPLES=OFF \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules \
    -D BUILD_EXAMPLES=ON ..

该命令执行了多次测试并显示了OpenCV 3.3.0的常规配置,但最后我收到了以下错误:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
Protobuf_LIBRARY
    linked by target "opencv_dnn_modern" in directory /home/pi/opencv_contrib-3.3.0/modules/dnn_modern

-- Configuring incomplete, errors occurred!
See also "/home/pi/opencv-3.3.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/pi/opencv-3.3.0/build/CMakeFiles/CMakeError.log".

我有一个opencv_contrib-3.3.0目录,而不是opencv_contrib,这就是为什么我将-3.3.0包含在make中。

1 个答案:

答案 0 :(得分:0)

我通过以下步骤解决了这个问题:

  1. 删除opencv目录中的构建文件夹
  2. 重新构建构建文件夹:mkdir build
  3. 转到该构建目录:cd build
  4. make中添加以下行:-D BUILD_opencv_dnn_modern=OFF 并运行如下:

    cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_C_EXAMPLES=OFF \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D BUILD_opencv_dnn_modern=OFF \
    -D ENABLE_NEON=ON \
    -D ENABLE_VFPV3=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules \
    -D BUILD_EXAMPLES=ON ..