Tuesday, August 16, 2016

[OpenCV] To install OpenCV on Debian and create a test project using Netbeans

This document is the steps to install OpenCV on Debian and create a test project using Netbeans for my reference in case.

#Prepare the build environment GCC、Cmake、pkgconfig
$sudo apt-get -y install build-essential cmake pkg-config

#Install ImageI/O libraries
$sudo apt-get -y install libjpeg62-dev libtiff4-dev libjasper-dev

#Install Viode I/O libraries
$sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
$sudo apt-get -y install libdc1394-22-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

#Install GTK+2.x and QT libraries
$sudo apt-get -y install  libgtk2.0-dev libqt4-dev



#(Optional)Install support for Firewire video cameras
$sudo apt-get -y install libdc1394-22-dev

#(Optional)Install video streaming libraries
$sudo apt-get -y install libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

#(Optional)Install the Python development environment and the Python Numerical libraries
$sudo apt-get -y install python-dev python-numpy

#(Optional)Install TBB library(Intel® Threading Building Blocks)
$sudo apt-get -y install libtbb-dev

#Install libraries that are used to optimize various routines inside of OpenCV:
$sudo apt-get install libatlas-base-dev gfortran

#Install OpenGL library
$sudo apt-get install freeglut3-dev gstreamer0.10-plugins-good


#Install Gstreamer library
$sudo apt-get install gstreamer0.10-plugins-good


#Download OpenCV and unpack it:
$wget -O opencv-2.4.13.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.13/opencv-2.4.13.zip/download
or
$wget -O opencv-3.1.0.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/3.1.0/opencv-3.1.0.zip/download
$unzip opencv-2.4.13.zip
$cd opencv-2.4.13

#mkdir build and make OpenCV
$mkdir build
$cd build
$cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON  -D BUILD_EXAMPLES=ON ..
$make -j4
$sudo make install
$sudo ldconfig

I use Netbeans as my IDE tool to develop and program OpenCV GUI and applications.


Reference:
http://www.pyimagesearch.com/2015/02/23/install-opencv-and-python-on-your-raspberry-pi-2-and-b/
http://ccw1986.blogspot.tw/2014/03/opencvbuild-opencv-static-library-on.html
https://thefreecoder.wordpress.com/2012/09/10/use-netbeans-to-work-with-opencv-on-ubuntuand-linux-mint-and-other-distros-too/

No comments: