Open-CV is a Open source Computer Vision library of a programming function for real time computer vision.
Here I'll be telling you about how to install a OpenCV in your Desktop.
Download OpenCV setup from http://opencv.org/downloads.html
Also download cMake setup from http://www.cmake.org/cmake/resources/software.html
Now install both software in any drive of your computer
Run cMake. This will create a library solution for OpenCV.
- Locate the source code using the “Browse Source” Button. This is where you installed OpenCV.
- Locate where you want to install the library using the “Browse Build” button.
- Click Configure to create the folders and files needed.
- It will ask for you to specify the generator for the project. Choose the version of Visual Studio that you are using.
- Click Finish.
- Now click to configure, do not mind the red area as in our case we need not to worry about it and press configure again and then press generate option.
- Open your visual studio and open your build folder in the opencv. In that you'll see the solution of open-cv. Click on open option and then finish.
- After finish it would few time to install all files.
- After the loading of all files you are ready to build the OpenCV, so click on build option and it would also take few time to build and then you'll get a 31 succeeded and 3 skipped.
- Now open new visual studio and create a new project in Win32 console
- Click finish and then load a sample program to it.
- Since you may see so many errors in your program so to rectify them you need to do some configuration.
- Go to properties ---> VC++ directories ---> Include directories.
- In include directories choose the edit option.
- New line (New folder icon in the box) ---> Browse for OpenCV2.2 - include - opencv folder
- Again select New line ---> Browse for OpenCV2.2 - select include folder
- Click Apply option.
- Click on library directories, and click on edit
- Select New line ---> browse for lib folder in OpenCV2.2
- Click Apply.
- Now click on Linker, then to the Input option as shown in the figure.
- Click to Additional dependencies and copy the following libraries from the library folder and paste their path here.
Copy the library path (where you have installed your opencv):
C:\OpenCV2.2\lib\opencv_core220d.lib
C:\OpenCV2.2\lib\opencv_highgui220d.lib
C:\OpenCV2.2\lib\opencv_video220d.lib
C:\OpenCV2.2\lib\opencv_ml220d.lib
C:\OpenCV2.2\lib\opencv_legacy220d.lib
C:\OpenCV2.2\lib\opencv_imgproc220d.lib
- Now you can run your program but before that copy the image file to the path where your this project has been created.
Here is a sample program for opencv:
#include "cv.h" // include it to used Main OpenCV functions.
#include "highgui.h" //include it to use GUI functions.
int main(int argc, char** argv)
{
IplImage* img = cvLoadImage( "image.jpg" ); //change the name (image.jpg) according to your Image filename.
cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
cvShowImage("Earth", img);
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( "Earth" );
return 0;
}
















No comments:
Post a Comment