Sunday 21 August 2016

Installing OpenCV on Raspberry Pi

OpenCV is one of the most powerful libraries for image processing, providing many functions such as facial recognition to object detection and many more check here . In Order to use it with your raspberry pi you need to follow some steps to enable your py script to use it.

Things you will need:

1- Putty(SSH Client)
2- Internet connectivity on your pi

STEPS TO INSTALL:

1- Expand memory

Log in with your pi account through SSH (username=pi , password=raspberry)by default,

Enter  

sudo raspi-config


Expand Filesystem and press Enter , finish then reboot your pi by entering the following command

sudo reboot



2- Update and install all the essential files needed for the build


sudo apt-get update
---wait for the update to finish


sudo apt-get install build-essential cmake pkg-config python-dev libgtk2.0-dev libgtk2.0 zlib1g-dev libpng-dev libjpeg-dev libtiff-dev libjasper-dev libavcodec-dev swig unzip
sudo apt-get install libopencv-dev python-opencv python-dev


3- Download the opencv zip file from server


wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/opencv-2.4.9.zip

unzip opencv-2.4.9.zip
---unzips the compressed file

4- Installing OpenCV



cd opencv-2.4.9
---changes directory to the location where opencv is downloaded


cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_ocl=OFF
---After the completion of above step

Enter 


make
---This process is a little time consuming

After this Enter

sudo make install
---This final step will install the opencv

If the installation was successful the following command will show the current installed version of OpenCV


pkg-config --modversion opencv 



















Happy coding ;)

No comments:

Post a Comment