OpenCV has been used by many people to deploy Image Processing which can support general programming languages, such as: C/C++, Java, Python, etc. Actually, we’ll find a lot of tutorial outside there how to install OpenCV. In my case, however, I’d like to make my own notes about how to install it in my OS (LinuxMint-17.3). Since It’s a bit tricky and many dependencies library you need to install before. OK, let’s check it out:
Step.1 – Update System (OPTIONAL! If your system has been updated before, you can jump to the next-step)
sudo apt-get update sudo apt-get upgrade reboot
Step.2 – Install Compiler
sudo apt-get install build-essential cmake
Step.3 – Install IMAGE Manipulation Libraries
sudo apt-get install zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libjasper-dev libopenexr-dev libgdal-dev
Step.4 – Install VIDEO Manipulation Libraries
sudo apt-get install libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev
Step.5 – Install Supporting Math Libraries
sudo apt-get install libtbb-dev libeigen3-dev
Step.6 – Update Python Language & Java
sudo apt-get install python-dev python-tk python-numpy python3-dev python3-tk python3-numpy sudo apt-get install python-matplotlib sudo apt-get install ant default-jdk
In my previous case, I have updated my JDK. So, I just skip the “default-jdk” in the last command above.
Step.7 – Compiling OpenCV
First, you can download the OpenCV source from here. In my case, I’d like prefer to choose version 3.0.0 as suggested by some articles outside there because it’s easier and more stable to install. I put the source file and unzip it in /home/Projects folder as my working directory.
unzip opencv-3.0.0.zip cd opencv-3.0.0/ mkdir build cd build
Make sure you already inside build folder of your working directory (/home/macgyver/Projects/opencv-3.0.0/build). Then run this command to start compiling.
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. make -j4 sudo make install sudo ldconfig
Now, your OpenCV is ready to use and enjoy it!