Introduction: -
For past few years I am using OpenCV for my image processing library. Initially I stared with Matlab. But the
as usual the programing in Matlab was easy but the execution was really slow. For my real time image processing project I stared to search for a good Image processing library and found OpenCv. It was not only fast but I can built exe files unlike m files in Matlab. I this tutorial along with a brief intorduction, we will a very simple OpenCV program.
You can download OpenCv library form :- http://sourceforge.net/projects/opencvlibrary/ Latest version is 2.1. You will also have to setup the workspace. You can find it here. For DevC++ user the setup part is here.
Lets see some important features of OpenCV:-
OpenCV modules
There are mainly 4 modules in OpenCV. These are
For past few years I am using OpenCV for my image processing library. Initially I stared with Matlab. But the
as usual the programing in Matlab was easy but the execution was really slow. For my real time image processing project I stared to search for a good Image processing library and found OpenCv. It was not only fast but I can built exe files unlike m files in Matlab. I this tutorial along with a brief intorduction, we will a very simple OpenCV program.
You can download OpenCv library form :- http://sourceforge.net/projects/opencvlibrary/ Latest version is 2.1. You will also have to setup the workspace. You can find it here. For DevC++ user the setup part is here.
Lets see some important features of OpenCV:-
- Open source computer vision library in C/C++.
- Optimized and intended for real-time applications.
- OS/hardware/window-manager independent.
- Generic image/video loading, saving, and acquisition.
- Both low and high level API.
- Provides interface to Intel's Integrated Performance
- Primitives (IPP) with processor specific optimization (Intel processors).
OpenCV modules
There are mainly 4 modules in OpenCV. These are
- cv - Main OpenCV functions.
- cvaux - Auxiliary (experimental) OpenCV functions.
- cxcore - Data structures and linear algebra support.
- highgui - GUI functions.
Image data structure in OpenCV and a Sample Program:-
Now we have done enough reading, Lets try our hands at some programing. In this simple program we will load a image file and show in window. I assume you have sample image :-
sample.bmp.
#include "cv.h" //main OpenCV functions
#include "highgui.h" //OpenCV GUI functions¯include <stdio.h> so no need to re include it.
int main()
{
/* declare a new IplImage pointer, the basic
image data structure in OpenCV */
IplImage* newImg;
/* load an image named "sample.bmp", 1 means
this is a color image */
newImg = cvLoadImage("sample.bmp",1);
//create a new window
cvNamedWindow("Window", 1);
//display the image in the window
cvShowImage("Window", newImg);
//wait for key to close the window
cvWaitKey(0);
cvDestroyWindow( "Window" ); //destroy the window
cvReleaseImage( &newImg ); //release the memory for the image
return 0;
}
Thankssssss
ReplyDeleteWelcome Kalyan :)
ReplyDeletehai Ritesh
ReplyDeletethis is Musa, and I am new to opencv. I even don't know how to install the open cv. Could u please help me out.
Hi Musa, you can download OpenCv library from http://sourceforge.net/projects/opencvlibrary/.
ReplyDeleteFlow Linking OpenCV 2 library in DEVC++