opencv3 ubuntu安装脚本

来源:互联网 发布:学编程哪里好 编辑:程序博客网 时间:2024/05/21 08:01


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文件,执行即可

sudo apt-get --assume-yes updatesudo apt-get --assume-yes upgrade# raspberry pisudo rpi-update sudo apt-get --assume-yes install build-essential git cmake pkg-configsudo apt-get --assume-yes install libjpeg8-dev libtiff4-dev libjasper-dev libpng12-devsudo apt-get --assume-yes install libavcodec-dev libavformat-dev libswscale-dev libv4l-devsudo apt-get --assume-yes install libgtk2.0-devsudo apt-get --assume-yes install libatlas-base-dev gfortrancd~git clone https://github.com/Itseez/opencv.gitcd opencvgit checkout 3.1.0 cd~git clone https://github.com/Itseez/opencv_contrib.gitcd opencv_contribgit checkout 3.1.0 sudo --assume-yes apt-get install python2.7-dev python-pipsudo --assume-yes apt-get install python3-dev python3-pip  sudo pip3 install numpysudo pip install numpy# raspberry pisudo pip-3.2 install numpy cd~/opencvmkdir buildcd buildcmake -D CMAKE_BUILD_TYPE=RELEASE \-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 installsudo ldconfig echo -e"\e[91mIF ERROR"echo -e"change include to : #include\"/usr/include/hdf5/serial/hdf5.h\"\n"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

0 0