Hey guys,
Today's post is a guide of how you can Install OpenCV on your Odinub.
We will start with the installation of OpenCV and then I will share Python scripts to play with it.
So Odinub comes with preloaded Linux (Debian).
Installing OpenCV 3 on OdinubFollow all the given steps for that you have to open terminal and fire all the given commands.
Step 1: Install dependenciesThe first step is to update and upgrade any existing packages:
sudo apt-get update
sudo apt-get upgrade
Install some developer tools, including CMake, which helps us configure the OpenCV build process:
sudo apt-get install build-essential cmake pkg-config
we need to install some image I/O packages that allows us to load various image file formats from disk. Examples of such file formats include JPEG, PNG, TIFF, etc.:
also, the second command will allow us to load various video formats while using open cv.
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
Install the GTK Development library. This Library is used to build GUIs (Graphical User Interfaces) and is required for Highgui library of opencv which allows you to view images on the screen.
sudo apt-get install libgtk2.0-dev
Many operations inside of OpenCV (namely matrix operations) can be optimized further by installing a few extra dependencies:
sudo apt-get install libatlas-base-dev gfortran
Let’s install both the Python 2.7 and Python 3 header files so we can compile OpenCV with Python bindings:
sudo apt-get install python2.7-dev python3-dev
If you’re working with a fresh install of the OS, it is possible that these versions of Python are already at the newest version (you’ll see a terminal message stating this).
Step 2: Download the OpenCV source codeNow that we have our dependencies installed, let’s grab the 3.3.0 archive of OpenCV from the official OpenCV repository.
cd ~
git clone https://github.com/itseez/opencv.git
Now we will check and will go into the open cv directory
cd opencv
git checkout 3.1.0
Now
cd ~
git clone https://github.com/itseez/opencv_contrib.git
Now
cd opencv_contrib
git checkout 3.1.0
Now
pkg-config opencv -c
flagspkg-config opencv -libs
Step 3: How to install in Python 2or 3?wget https://bootstarp.pypa.io/get-pip.py
sudo python get-pip.py
Now install numpy if you have latest Os it will be preloaded with numpy
pip install numpy
Now
sudo apt-get install libopencv-dev python-opencv
Now we are almost done with the steps, let's check.
Open the terminal and
python
>>> import cv2
>>>import numpy
if this command will successfully run then you have installed OpenCV on Odinub. Now you can start tinker with OpenCV and Python.
OpenCV will be great tool to do some cool stuff like image processing, face detection, etc.
I hope that this guide will help you to install the OpenCV.
Comments
Please log in or sign up to comment.