OPENCV 在MAC或者UBUNTU下编译安装

2019-12-24  本文已影响0人  Xintao丶

下载opencv 和对应的opencv_contrib

国内环境不好 可能需要挂代理下载一些文件到opencv/.cache中

在.cache/xfeatures2d/boostdesc下执行
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_lbgm.i -O 0ae0675534aa318d9668f2a179c2a052-boostdesc_lbgm.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_256.i -O e6dcfa9f647779eb1ce446a8d759b6ea-boostdesc_binboost_256.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_128.i -O 98ea99d399965c03d555cef3ea502a0b-boostdesc_binboost_128.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_binboost_064.i -O 202e1b3e9fec871b04da31f7f016679f-boostdesc_binboost_064.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_hd.i -O 324426a24fa56ad9c5b8e3e0b3e5303e-boostdesc_bgm_hd.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm_bi.i -O 232c966b13651bd0e46a1497b0852191-boostdesc_bgm_bi.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/34e4206aef44d50e6bbcd0ab06354b52e7466d26/boostdesc_bgm.i -O 0ea90e7a8f3f7876d450e4149c97c74f-boostdesc_bgm.i

在.cache/xfeatures2d/vgg下执行
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_120.i -O 151805e03568c9f490a5e3a872777b75-vgg_generated_120.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_64.i -O 7126a5d9a8884ebca5aea5d63d677225-vgg_generated_64.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_48.i -O e8d0dcd54d1bcfdc29203d011a797179-vgg_generated_48.i
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/fccf7cd6a4b12079f73bbfb21745f9babcd4eb1d/vgg_generated_80.i -O 7cd47228edec52b6d82f46511af325c5-vgg_generated_80.i

在.cache/data下执行
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/8afa57abc8229d611c4937165d20e2a2d9fc5a12/face_landmark_model.dat -O 7505c44ca4eb54b4ab1e4777cb96ac05-face_landmark_model.dat

在.cache/ippicv下执行 注意:不同系统需要下载不同的文件 请在CMakeDownloadLog下定位
wget https://raw.githubusercontent.com/opencv/opencv_3rdparty/32e315a5b106a7b89dbed51c28f8120a48b368b4/ippicv/ippicv_2019_mac_intel64_general_20180723.tgz -O fe6b2bb75ae0e3f19ad3ae1a31dfa4a2-ippicv_2019_mac_intel64_general_20180723.tgz

在opencv/build下执行

cmake -D OPENCV_EXTRA_MODULES_PATH=OPENCV_CONTRIB_PATH/modules  ..
查看有没有下载失败的文件 否则make会出问题
make 
sudo make install

OPENCV+CUDA编译

cmake -D OPENCV_EXTRA_MODULES_PATH=OPENCV_CONTRIB_PATH/modules -D WITH_CUDA=ON ..

自定义nvcc路径

export PATH=/usr/local/cuda/bin:"$PATH"
上一篇下一篇

猜你喜欢

热点阅读