Partiamo da una immagine Raspbian del 2017-04-10
$ uname -a
Linux raspberrypi 4.4.50-v7+ #970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux
Ci assicuriamo che il nostro S.O. Raspbian sia aggiornato:
sudo su apt-get update -y apt-get upgrade -y apt-get dist-upgrade -y rpi-update apt-get autoremove reboot $ uname -a Linux rpi-opencv 4.9.28-v7+ #999 SMP Tue May 16 14:03:19 BST 2017 armv7l GNU/Linux
Disinstalliamo la la precedente versione (2.4.9.1) installata di default su Raspbian:
sudo apt-get remove libopencv* sudo apt-get autoremove
Per procedere servono almeno 2GB di spazio libero, altrimenti bisogna compilare su una unità esterna formattata come ext2
df -h
Abilitiamo la "Raspberri PI Camera"
sudo raspi-config
INSTALLAZIONE DEI PACCHETTI NECESSARI AD OPENCV
sudo su # compilatore e strumenti di sviluppo apt-get install -y build-essential apt-get install -y cmake cmake-curses-gui pkg-config apt-get install git # necessari apt-get install libgtk2.0-dev apt-get install libjpeg8-dev sudo apt-get install \ libjpeg-dev \ libtiff5-dev \ libjasper-dev \ libpng12-dev \ libavcodec-dev \ libavformat-dev \ libswscale-dev \ libeigen3-dev \ libxvidcore-dev \ libx264-dev \ libgtk2.0-dev # opzionali (li ho installati) apt-get install python-dev python-numpy sudo apt-get install python2.7-dev python2-numpy sudo apt-get install python3-dev python3-numpy sudo apt-get install libatlas-base-dev gfortran sudo apt-get -y install libv4l-dev v4l-utils # opzionali (non li ho installati) apt-get install libpng++-dev libpng3 libpnglite-dev zlib1g-dbg zlib1g zlib1g-dev pngtools libtiff4 libtiffxx0c2 libtiff-tools libeigen3-dev apt-get install libpng12-0 libjpeg8 libjpeg8-dbg libjpeg-progs ffmpeg libavcodec53 libavformat53 libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev libxine1-ffmpeg libxine-dev libxine1-bin libunicap2 libunicap2-dev swig libv4l-0 libv4l-dev libgtk2.0-dev
# python-dev # https://packages.debian.org/it/wheezy/python-dev
# python-numpy # https://packages.debian.org/it/wheezy/python-numpy
# libjpeg8-dev # https://packages.debian.org/it/wheezy/libjpeg8-dev
# libpng12-dev # https://packages.debian.org/it/wheezy/libpng12-dev
# libtiff4-dev # https://packages.debian.org/it/wheezy/libtiff4-dev
# libjasper-dev # https://packages.debian.org/it/wheezy/libjasper-dev
# libpng12-0 # https://packages.debian.org/it/wheezy/libpng12-0
COMPILAZIONE ED INSTALLAZIONE DI OPENCV
Download di OpenCV da http://opencv.org/releases.html o http://sourceforge.net/projects/opencvlibrary/files/opencv-unix
https://github.com/opencv/opencv
wget https://github.com/opencv/opencv/archive/3.2.0.zip -O opencv_source.zip wget https://github.com/opencv/opencv_contrib/archive/3.2.0.zip -O opencv_contrib.zip unzip opencv_source.zip unzip opencv_contrib.zip cd opencv-3.2.0 mkdir build cd build cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D BUILD_DOCS=OFF \ -D BUILD_EXAMPLES=OFF \ -D BUILD_TESTS=OFF \ -D BUILD_opencv_ts=OFF \ -D BUILD_PERF_TESTS=OFF \ -D INSTALL_C_EXAMPLES=ON \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.2.0/modules \ -D ENABLE_NEON=ON \ -D WITH_LIBV4L=ON \ ../Se si vuole modificare o visualizzare la configurazione tramite interfaccia grafica:
ccmake ../Configurazione
press ‘c’ to configure once done toggle the options you want.
press ‘c’ again to configure with your new settings
press ‘g’ to generate the Makefile
press ‘q’ to quit without change
Finalmente si può passare alla compilazione. Questa operazione può durare più di 12 ore! (sulla raspberry Pi 1) meno di 2 ore sulla Raspberry 3
sudo su date; make -j4 install; date ldconfig
RIFERIMENTI / LINK
http://pklab.net/index.php?lang=IT&id=392
http://www.raspberrypi.org/tag/opencv/
http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation
http://robertcastle.com/2014/02/installing-opencv-on-a-raspberry-pi/
http://www.raspberrypi.org/magpi-issues/MagPi28.pdf
http://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/
https://github.com/Guzunty/Pi/wiki/Say-Hello-to-PiTeR
http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/
Nessun commento:
Posta un commento