1.必須モジュール
build-essential cmake pkg-config cmake-qt-gui mesa-utils libgl1-mesa-dri
cmake-qt-gui は、UIでパラメータの設定をしなければ不要
2.基本演算系
libatlas-base-dev gfortran libeigen3-dev
3.画像、動画モジュール
libjpeg-dev libtiff5-dev libpng12-dev libjasper-dev
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libv4l-dev
4.OpenCVのGUIモジュール
libgtk2.0-dev libgtk-3-dev
5.3Dモデル表示モジュール
libvtk5-dev libvtk5-qt4-dev python-vtk tcl-vtk
libqt4-core libqtgui4 libqt4-test libqt4-opengl-dev (Qt系が必要なら)
6.python
python3-dev 2系は使わないので、、、
7.深層学習
libprotobuf-dev protobuf-compiler
8.ドキュメント系
sphinx-common doxygen
でも、インストールしない
9.PlantUML
http://plantuml.com/download からダウンロードして、リネームかシンボリックリンク
cd /usr/share/java にコピーする
sudo ln -s plantuml.8048.jar plantuml.jar
10. cmake 設定
contrib不要の場合
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D PLANTUML_JAR=/usr/share/java/plantuml.jar \
-D ENABLE_NEON:BOOL=ON \
-D WITH_TBB=ON -D BUILD_TBB=ON \
-D WITH_QT=ON -D WITH_OPENGL=ON \
-D BUILD_EXAMPLES=ON ..
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D PLANTUML_JAR=/usr/share/java/plantuml.jar \
-D ENABLE_NEON:BOOL=ON \
-D WITH_TBB=ON -D BUILD_TBB=ON \
-D WITH_QT=OFF -D WITH_OPENGL=OFF \
-D BUILD_EXAMPLES=ON ..
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D PLANTUML_JAR=/usr/share/java/plantuml.jar \
-D ENABLE_NEON:BOOL=ON \
-D WITH_TBB=ON -D BUILD_TBB=ON \
-D WITH_QT=OFF -D WITH_OPENGL=OFF \
-D BUILD_EXAMPLES=ON ..
contribを含める場合
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D PLANTUML_JAR=/usr/share/java/plantuml.jar \
-D ENABLE_NEON=ON \
-D WITH_TBB=ON -D BUILD_TBB=ON \
-D WITH_QT=ON -D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.1/modules \
-D BUILD_EXAMPLES=ON ..
一発shellはこれ(^^)
#! /bin/bash
date;
if [[ `lsb_release -d` =~ .*Raspbian.* ]]
then
echo "";
read -p " Continue installing OpenCV (y/n) ? " CONTINUE
if [[ "$CONTINUE" == "y" || "$CONTINUE" == "Y" ]]; then
echo "";
echo "Installing OpenCV";
echo "";
# sudo apt-get update -y && sudo apt-get upgrade -y
# sudo apt-get install -y build-essential cmake pkg-config
# sudo apt-get install -y libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
# sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
# sudo apt-get install -y libxvidcore-dev libx264-dev
# sudo apt-get install -y libgtk2.0-dev libgtk-3-dev
# sudo apt-get install -y libatlas-base-dev gfortran
# sudo apt-get install -y python2.7-dev python3-dev
date;
if [[ `lsb_release -d` =~ .*Raspbian.* ]]
then
echo "";
read -p " Continue installing OpenCV (y/n) ? " CONTINUE
if [[ "$CONTINUE" == "y" || "$CONTINUE" == "Y" ]]; then
echo "";
echo "Installing OpenCV";
echo "";
# sudo apt-get update -y && sudo apt-get upgrade -y
# sudo apt-get install -y build-essential cmake pkg-config
# sudo apt-get install -y libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
# sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
# sudo apt-get install -y libxvidcore-dev libx264-dev
# sudo apt-get install -y libgtk2.0-dev libgtk-3-dev
# sudo apt-get install -y libatlas-base-dev gfortran
# sudo apt-get install -y python2.7-dev python3-dev
sudo apt-get install -y build-essential cmake pkg-config cmake-qt-gui mesa-utils libgl1-mesa-dri
sudo apt-get install -y libatlas-base-dev gfortran libeigen3-dev
sudo apt-get install -y libjpeg-dev libtiff5-dev libpng12-dev libjasper-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libv4l-dev
sudo apt-get install -y libgtk2.0-dev libgtk-3-dev
sudo apt-get install -y libvtk5-dev libvtk5-qt4-dev python-vtk tcl-vtk
sudo apt-get install -y libqt4-core libqtgui4 libqt4-test libqt4-opengl-dev
sudo apt-get install -y python3-dev
sudo apt-get install python-dev python-pip
sudo apt-get install python-dev python-pip
sudo apt-get install -y libprotobuf-dev protobuf-compiler
sudo apt-get install -y sphinx-common doxygen
cd ~
wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.1.zip
unzip opencv.zip
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/master.zip
unzip opencv_contrib.zip
mv ~/opencv_contrib-master ~/opencv_contrib-3.4.1
cd ~/opencv-3.4.1/
mkdir build
cd build
# cmake -D CMAKE_BUILD_TYPE=RELEASE \
# -D CMAKE_INSTALL_PREFIX=/usr/local \
# -D INSTALL_PYTHON_EXAMPLES=OFF \
# -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.0/modules \
# -D BUILD_EXAMPLES=OFF ..
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D PLANTUML_JAR=/usr/share/java/plantuml.jar \
-D ENABLE_NEON=ON \
-D WITH_TBB=ON -D BUILD_TBB=ON \
-D WITH_QT=ON -D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.1/modules \
-D BUILD_EXAMPLES=ON ..
sudo make install
sudo ldconfig
else
echo "";
echo "Skipping OpenCV installation";
echo "";
fi
else
echo "Installing opencv python for non-Raspbian";
sudo -H pip3 install opencv-python
sudo -H pip3 install opencv-contrib-python
fi
date;