ubuntu安装opencv4.4 配置darknet
基础配置:
ubuntu 16.04.6
cuda 10.0 cudnn7.6.4
anaconda 4.8.2 python 3.7.6
准备:
apt install -y build-essential git libgtk-3-dev
####如果不行,先 apt update
conda deactivate
安装cmake:
// A code block
curl -O -L https://github.com/Kitware/CMake/releases/download/v3.18.2/cmake-3.18.2-Linux-x86_64.sh
sh cmake-*.sh --prefix=$HOME/Applications/
vi ~/.bashrc
export PATH=$HOME/Applications/cmake-3.18.2-Linux-x86_64/bin:$PATH
安装opencv4.4:
最美味的材料往往只需要很简单的烹饪方式
(其实主要是如果cmake设置过于复杂,编译通不过,吐血)
// A code block
cd /root/codes
git clone -b 4.4.0 --depth 1 https://github.com/opencv/opencv.git
git clone -b 4.4.0 --depth 1 https://github.com/opencv/opencv_contrib.git
cd opencv/
mkdir _build && cd _build/
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j7
make install
如果cmake 完,出现一个done! 后面就基本没啥问题了
安装darknet:
// A code block
cd ~/Codes/
git clone https://github.com/AlexeyAB/darknet.git
cd darknet/
./build.sh
成功后目录下会多出两个文件:
后面这两个文件可以用于python调用
执行darknet:
./darknet: error while loading shared libraries: libopencv_highgui.so.4.4: cannot open shared object file: No such file or directory
这时候shell执行
find / -name libopencv_highgui.so.4.4
得到
/root/codes/opencv/_build/lib/libopencv_highgui.so.4.4
/usr/local/lib/libopencv_highgui.so.4.4
此时执行:
cd /etc/ld.so.conf.d
vim opencv.conf
###写入:
/root/codes/opencv/_build/lib/libopencv_highgui.so.4.4
/usr/local/lib/libopencv_highgui.so.4.4
####退出后执行:
ldconfig
然后可以用来,完美!
参考链接:
[1]:链接: 安装cmake.
[2]:链接: 安装opencv.
[3]:链接: 解决darknet找不到库.