2

Installing OpenCV on Windows7 64 bit

Posted by Unknown on 8:13 AM in , , , , ,
I'm using OpenCV 2.2 for my project that is Hand Gesture Recognition Interface and I had so many initial problems with the set up on a 64 bit system so decided to blog about it. OpenCV is no doubt a great tool for video and image processing but as its an open source it depends and behaves differently from one system to another.

This is what we did to install it on Windows 7 Home Premium 64 bit

Prerequisites :
1. OpenCV 2.2 for Windows download from sourceforge.net
2. CMake 2.8 to compile it to your environment
3. Visual Studio 2010.

Step I:
Install OpenCV :
1. Install OpenCV
2. Click on the set path for all users

Now your OpenCV is installed , by default it is installed in C drive

Step II:

Install Cmake
Click on Cmake GUI

1. In the " source code"text box -Give the path where your OpenCV was installed (By Def C:\OpenCV2.2)
2. In the next text box that is "where to build binaries"- Give a new path say
" C:\OpenCV2.2\build"
3. Click on Configure button and resolve the conflicts keep pressing it until Generate button is active.
4. Click on Generate.
5. For compilers choose from the drop down list according to the version of Visual Studio you have installed.

Now your build is ready.

Step III:
1. Start Visual Studio
2. Go to File-> Open->Project/Solution and navigate to
the build folder (C:\OpenCV2.2\build)
3. Choose OpenCV.sln , wait until it is ready
4. Go to Build and choose Build Solution

Step IV:
1. Create a new project(Win32 App)
2. Right click on the project (left panel) and select properties
3.Under "Configuration Properties" select "VC++ Directories"
4. Under "include" add "C:\OpenCV2.2\include" and "C:\OpenCV2.2\include\opencv"
5. Under "library " add "C:\OpenCV2.2\lib"
6.Under "Configuration Properties" select "Linker" and then "Input"
add "Additional dependencies"
opencv_core220d.lib
opencv_highgui220d.lib
opencv_video220d.lib
opencv_ml220d.lib
opencv_legacy220d.lib
opencv_imgproc220d.lib


This is when you know you have installed it as per your system's environment.
Then it is ready to run your helloworld equivalent in OpenCV -loading an image.
*/
------------
Running your first program:


Under Source section create a new "filename.cpp" file , debug and execute the following program
Store the image in the documents->visual studio->projects->firsprogram folder

#include cv.h
#include highgui.h
#include cxcore.h

int _tmain(int argc, _TCHAR* argv[])
{
IplImage* img = cvLoadImage( "Filename.jpg" ); //any image file
cvNamedWindow( "Example1", CV_WINDOW_AUTOSIZE );
cvShowImage("Example1", img);
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( "Example1" );
return 0;
}
------------

2 Comments


nice, cool and techy.. just the thing i was looking for. Thanks for posting this.


Hey Ketan,
Thank you,happy that someone somewhere could use it. Enjoy coding Computer Vision is amazing and very less explored.

Post a Comment

Copyright © 2009 High on Life All rights reserved. Theme by Laptop Geek. | Bloggerized by FalconHive.