Opencv4.4安装

opencv4.4安装及问题解决

cd ~/<my_working_directory>
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git
cd ~/opencv
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/opencv4.4 -DOPENCV_EXTRA_MODULES_PATH=/home/zane/Downloads/opencv_contrib-4.4.0/modules -DOPENCV_GENERATE_PKGCONFIG=ON ..

问题解决:

if you need the cfeatures2d module, you have to solve this problem first, if you don’t try to disable it: cmake -DBUILD_opencv_xfeatures2d=OFF

  1. fatal error: boostdesc_bgm.i: No such file or directory
cd ~/opencv-4.1.2/opencv_contrib-4.1.2/modules/xfeatures2d/src
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_lbgm.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_256.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_128.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_064.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_hd.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_bi.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_120.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_64.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_48.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_80.
  1. fatal error: features2d/test/test_detectors_regression.impl.hpp: No such file or directory
sudo cp -r ~/opencv-4.1.2/modules/features2d ~/opencv-4.1.2/build

在cmake项目中使用时,

cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
#需要指定所安装的opencv路径下的OpenCVConfig.cmake所在路径
set(OpenCV_DIR /usr/local/opencv4.4/lib/cmake/opencv)   

find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )

你可能感兴趣的:(计算机视觉,opencv,cv)