前端之家收集整理的这篇文章主要介绍了
opencv3 ubuntu安装脚本,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
3.0安装脚本下载地址:
https://github.com/cmayet/docker_python2.7_opencv3.0.0
#!/bin/bash
apt-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文件,执行即可
@H_403_56@
sudo apt-get --assume-yes update |
@H_403_56@
@H_403_56@
sudo apt-get --assume-yes upgrade |
@H_403_56@
@H_403_56@
# raspberry pi |
@H_403_56@
@H_403_56@
sudo rpi-update |
@H_403_56@
@H_403_56@
sudo apt-get --assume-yes install build-essential git cmake pkg-config |
@H_403_56@
@H_403_56@
sudo apt-get --assume-yes install libjpeg8-dev libtiff4-dev libjasper-dev libpng12-dev |
@H_403_56@
@H_403_56@
sudo apt-get --assume-yes install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev |
@H_403_56@
@H_403_56@
sudo apt-get --assume-yes install libgtk2.0-dev |
@H_403_56@
@H_403_56@
sudo apt-get --assume-yes install libatlas-base-dev gfortran |
@H_403_56@
@H_403_56@
git clone https://github.com/Itseez/opencv.git |
@H_403_56@
@H_403_56@
cd opencv |
@H_403_56@
@H_403_56@
git checkout 3.1.0 |
@H_403_56@
@H_403_56@
git clone https://github.com/Itseez/opencv_contrib.git |
@H_403_56@
@H_403_56@
cd opencv_contrib |
@H_403_56@
@H_403_56@
git checkout 3.1.0 |
@H_403_56@
@H_403_56@
sudo --assume-yes apt-get install python2.7-dev python-pip |
@H_403_56@
@H_403_56@
sudo --assume-yes apt-get install python3-dev python3-pip |
@H_403_56@
@H_403_56@
sudo pip3 install numpy |
@H_403_56@
@H_403_56@
sudo pip install numpy |
@H_403_56@
@H_403_56@
# raspberry pi |
@H_403_56@
@H_403_56@
sudo pip-3.2 install numpy |
@H_403_56@
@H_403_56@
cd~/opencv |
@H_403_56@
@H_403_56@
mkdir build |
@H_403_56@
@H_403_56@
cd build |
@H_403_56@
@H_403_56@
@H_488_403@cmake -D CMAKE_BUILD_TYPE=RELEASE \
@H_403_56@
@H_403_56@
-D CMAKE_INSTALL_PREFIX=/usr/local \ |
@H_403_56@
@H_403_56@
-D INSTALL_C_EXAMPLES=OFF \ |
@H_403_56@
@H_403_56@
-D INSTALL_PYTHON_EXAMPLES=OFF \ |
@H_403_56@
@H_403_56@
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ |
@H_403_56@
@H_403_56@
-D BUILD_EXAMPLES=ON .. |
@H_403_56@
@H_403_56@
make -j4 |
@H_403_56@
@H_403_56@
sudo make install |
@H_403_56@
@H_403_56@
sudo ldconfig |
@H_403_56@
@H_403_56@
echo -e"\e[91mIF ERROR" |
@H_403_56@
@H_403_56@
echo -e"change include to : #include\"/usr/include/hdf5/serial/hdf5.h\"\n" |
@H_403_56@
echo -e
"in /opencv_contrib-3.1.0/modules/hdf/include/opencv2/hdf/hdf5.hpp"
这个是3.x安装脚本,分两步执行,感兴趣的可以下载。
https://github.com/ThibaudKieffer/installation-shellscript-opencv-3.x-for-linux-mint-and-ubuntu