Ubuntu新源
现备份sudo cp /etc/apt/sources.list /etc/apt/sources.list.old,然后sudo gedit /etc/apt/sources.list修改,最后sudo apt-get update,sudo apt-get upgrade
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
一、使用Ubuntu的资源库(如果要用到机器学习包,就加上nose、lapack、atlas、numpy、blas、scipy)
sudo apt-get install build-essential sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
二、下载安装包opencv-3.0.0.zip
三、构建OpenCV
解压后进入到文件,然后执行以下命令,如果make install执行出错使用sudo make install,最后完成OpenCV构建
mkdir build cd build cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. make make install
四、可能出现的问题
1.file DOWNLOAD HASH mismatch。hash校验值不符的问题。自行从http://sourceforge.net/projects/opencvlibrary/files/3rdparty/ippicv下载,然后将下载的文件~/opencv-3.0.0/3rdparty/ippicv/downloads/linux-8b449a536a2157bcad08a2b9f266828b ,代替原来的同名文件。
2.有部分库缺失。在CentOS上安装OpenCV遇到库缺失,尚未找到解决方法。