3.0安装脚本下载地址:
https://github.com/cmayet/docker_python2.7_opencv3.0.0
#!/bin/bashapt-get update
apt-get install -y --no-install-recommends apt-utils
apt-get install -y --no-install-recommends python python-pip \
libpython2.7 \
build-essential \
gfortran \
libatlas-base-dev \
python-dev \
python2.7-dev \
python-tk \
cmake pkg-config \
libjpeg8-dev \
libtiff5-dev \
libjasper-dev \
libpng12-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libv4l-dev wget \
unzip
pip install --upgrade pip
pip install numpy
wget --no-check-certificate https://codeload.github.com/opencv/opencv/zip/3.0.0
unzip 3.0.0 && rm -rf 3.0.0
cd opencv-3.0.0&& mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE ..
make -j 4
make install
apt-get remove --purge -y gfortran build-essential cmake python-pip
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives
3.1安装地址:
代码地址:https://github.com/willGuimont/Install-OpenCV-3-linux
下面是3.1脚本,另存为sh文件,执行即可
sudo apt-get --assume-yes update |
sudo apt-get --assume-yes upgrade |
# raspberry pi |
sudo rpi-update |
sudo apt-get --assume-yes install build-essential git cmake pkg-config |
sudo apt-get --assume-yes install libjpeg8-dev libtiff4-dev libjasper-dev libpng12-dev |
sudo apt-get --assume-yes install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev |
sudo apt-get --assume-yes install libgtk2.0-dev |
sudo apt-get --assume-yes install libatlas-base-dev gfortran |
cd~ |
git clone https://github.com/Itseez/opencv.git |
cd opencv |
git checkout 3.1.0 |
cd~ |
git clone https://github.com/Itseez/opencv_contrib.git |
cd opencv_contrib |
git checkout 3.1.0 |
sudo --assume-yes apt-get install python2.7-dev python-pip |
sudo --assume-yes apt-get install python3-dev python3-pip |
sudo pip3 install numpy |
sudo pip install numpy |
# raspberry pi |
sudo pip-3.2 install numpy |
cd~/opencv |
mkdir build |
cd build |
-D CMAKE_INSTALL_PREFIX=/usr/local \ |
-D INSTALL_C_EXAMPLES=OFF \ |
-D INSTALL_PYTHON_EXAMPLES=OFF \ |
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ |
-D BUILD_EXAMPLES=ON .. |
make -j4 |
sudo make install |
sudo ldconfig |
echo -e"\e[91mIF ERROR" |
echo -e"change include to : #include\"/usr/include/hdf5/serial/hdf5.h\"\n" |
这个是3.x安装脚本,分两步执行,感兴趣的可以下载。
https://github.com/ThibaudKieffer/installation-shellscript-opencv-3.x-for-linux-mint-and-ubuntu
原文链接:https://www.f2er.com/ubuntu/354910.html