ubuntu18.04上安装opencv3.2.0和opencv_contrib报错

给jetson nano B01配置完ROS melodic环境,打算安装turtlebot,需要安装OpenCV3.2.0,并将GPU加速支持加入编译opencv,源码安装opencv时出现问题:

CMake Error at cmake/OpenCVModule.cmake:286 (add_subdirectory):
  The binary directory

    /home/fdse/tools/opencv-3.2.0/release/modules/cudaarithm/.cudaarithm

  is already used to build a source directory.  It cannot be used to build
  source directory

    /home/fdse/tools/opencv_contrib/modules/cudaarithm

  Specify a unique binary directory name.
Call Stack (most recent call first):
  modules/CMakeLists.txt:7 (ocv_glob_modules)


CMake Error at cmake/OpenCVModule.cmake:286 (add_subdirectory):
  The binary directory

    /home/fdse/tools/opencv-3.2.0/release/modules/cudabgsegm/.cudabgsegm

  is already used to build a source directory.  It cannot be used to build
  source directory

    /home/fdse/tools/opencv_contrib/modules/cudabgsegm

  Specify a unique binary directory name.
Call Stack (most recent call first):
  modules/CMakeLists.txt:7 (ocv_glob_modules)


CMake Error at cmake/OpenCVModule.cmake:286 (add_subdirectory):
  The binary directory

    /home/fdse/tools/opencv-3.2.0/release/modules/cudacodec/.cudacodec

  is already used to build a source directory.  It cannot be used to build
  source directory

    /home/fdse/tools/opencv_contrib/modules/cudacodec

  Specify a unique binary directory name.
Call Stack (most recent call first):
  modules/CMakeLists.txt:7 (ocv_glob_modules)


CMake Error at cmake/OpenCVModule.cmake:286 (add_subdirectory):
  The binary directory

    /home/fdse/tools/opencv-3.2.0/release/modules/cudafeatures2d/.cudafeatures2d

  is already used to build a source directory.  It cannot be used to build
  source directory

    /home/fdse/tools/opencv_contrib/modules/cudafeatures2d

  Specify a unique binary directory name.
Call Stack (most recent call first):
  modules/CMakeLists.txt:7 (ocv_glob_modules)

原因是opencv_conteib的版本与opencv不一致,克隆opencv的时候加上-b 3.2.0 ,同样的,克隆opencv_contrib时也克隆3.2.0版本的,加上-b 3.2.0,然后就不会报错了

你可能感兴趣的:(opencv)