Tuesday, January 11, 2011

opencv 2.2 installation on visual studio 2008

[1] Download opencv 2.2
http://sourceforge.net/projects/opencvlibrary/files/opencv-win/

[2] Double click and lauch OpenCV-2.2.0-win32-vs2010.exe. this exe compatible with 32 bit OS. if you are using 64bit version you must use CMake to build OpenCV binaries from the sources .
Click "Next >"
opencv 2.2 setup wizard
















[3] Click "I Agree"



opencv 2.2 license agreement
















[4] Then Choose second option "Add Opencv to the system PATH for all users" and click "Next >" and finish the installation.



opencv install options
















[5] Lauch the visual studio. here i used visual studio 2008.
click "file" menu and "new" "project" then select Visual C++ and win32console application

















[6] click "Next >"




















[7] Click "Finish"




o















[8] then click "tools" menu and select "option" and chose "VC++ directory"




















[9] select "include files" from the drop down and add below links
C:\OpenCV2.2\include\opencv
C:\OpenCV2.2\include



adding opencv library files into visual studio

















[10] Then select "Library files" from drop down and add link
C:\OpenCV2.2\lib




















[11] Then go to solution explorer and right click on the project "test1" ( i had named my project as "test1" )



simple opencv application using visual studio




















[12] Brows to C/C++ and linker and click on "Additional Dependencies"
















[13] Add below links and click "ok"  and "Apply"

C:\OpenCV2.2\lib\opencv_calib3d220d.lib
C:\OpenCV2.2\lib\opencv_contrib220d.lib
C:\OpenCV2.2\lib\opencv_core220d.lib
C:\OpenCV2.2\lib\opencv_features2d220d.lib
C:\OpenCV2.2\lib\opencv_ffmpeg220d.lib
C:\OpenCV2.2\lib\opencv_flann220d.lib
C:\OpenCV2.2\lib\opencv_gpu220d.lib
C:\OpenCV2.2\lib\opencv_highgui220d.lib
C:\OpenCV2.2\lib\opencv_imgproc220d.lib
C:\OpenCV2.2\lib\opencv_legacy220d.lib
C:\OpenCV2.2\lib\opencv_ml220d.lib
C:\OpenCV2.2\lib\opencv_objdetect220d.lib
C:\OpenCV2.2\lib\opencv_video220d.lib 

















[14] Goto your project folder and open "test1" (according to my example)













[15] Then add any *.jpg image ( here i choose "cat.jpg" ) to that folder













[16]then back to VS2008 add following source Code

 #include "stdafx.h"
#include "highgui.h"
int main( int argc, char** argv )
{
    IplImage* img = cvLoadImage( "cat.jpg" );  // rename according to your  *.jpg image
    cvNamedWindow( "Example11", CV_WINDOW_AUTOSIZE );
    cvShowImage( "Example11", img );
    cvWaitKey(0);
    cvReleaseImage( &img );
    cvDestroyWindow( "Example11" );
}



[17] Click "Buid". If there is no errors click "Build Solution" after succesfull build debug the program and get a output like below



simple opencv application















[18] This is simple procedure to determine OpenCV is working correctly.


Related Post

 [ Negative images for haartraining ]
http://www.tectute.com/2011/06/negative-background-images.html

[ Positive images for haartraining ]
http://www.tectute.com/2011/06/haartraining-positive-samples.html

[ Opencv haartraining and haar cascade xml ]
http://www.tectute.com/2011/06/opencv-haartraining.html

No comments:

Post a Comment

Related Posts