Introduction to OpenCV Tutorial



OpenCV is released under a BSD license and hence its free for both academic and commercial use. It has C++, C, Python and Java interfaces and supports Windows, Linux, Mac OS, iOS and Android.

OpenCV was designed for computational efficiency and with a strong focus on real-time applications. Written in optimized C/C++, the library can take advantage of multi-core processing.

Some of the basic features of OpenCV are listed below:

Sr.NoFeatures & Description
1Smoothing Images
This involve applying Blur,GaussianBlur,medianBlur and bilateral Filter.
2Eroding and Dilating
Apply two very common morphology operators: Dilation and Erosion.
3Morphology Transformations
OpenCV function morphologyEx to apply Morphological Transformation such as opening, closing,TopHat and BlackHat e.t.c.
4Image Pyramids
OpenCV functions pyrUp and pyrDown to down sample or up sample a given image.
4Basic Thresholding Operations
Perform basic thresholding operations using OpenCV function threshold.
5Adding borders to your images
OpenCV function copyMakeBorder is used to set the borders (extra padding to your image).
In OpenCV, the function remap offers a simple remapping implementation.
8Histogram Calculation
For simple purposes, OpenCV implements the function calcHist, which calculates the histogram of a set of arrays (usually images or image planes). It can operate with up to 32 dimensions.

Integrate OpenCV

These steps mentioned below explain how to integrate OpenCV in your applications.

Download OpenCV

You can download OpenCV from their official Website here.

Create User Library

In the next step we will create a user library of OpenCV, so we can use it as a Future Project.

Launch Eclipse and select Window and then Preferences from the menu. Navigate under Java and then Build Path and then User Libraries and click New.

Introduction to OpenCV Tutorial

Now enter the name for your library. In my case i am writing OpenCV-2.4.6.

After that , select your new user library(i-e: OpenCV-2.4.6) and click Add External JARs.

Browse through C:\OpenCV-2.4.6\build\java\ and select opencv-246.jar. After adding the jar, extend the opencv-246.jar and select Native library location and press Edit.

Introduction to OpenCV Tutorial

Select External Folder... and browse to select the folder C:\OpenCV-2.4.6\build\java\x64. If you have a 32-bit system you need to select the x86 folder instead of x64.

Press Ok and you are done. Now your user library has been created, so now you can reuse this configuration in any of the project.

Create OpenCV Project

Now Create a new java project in eclipse.

On the Java Settings step, under Libraries tab, select Add Library... and select OpenCV-2.4.6, then click Finish.

Introduction to OpenCV Tutorial

Click on finish and you are done.