9
Getting Started with OpenCV Using Visual Studio Using this pictorial guide, you will be able to create a console application with Visual Studio using OpenCV computer vision library. You will need to install Visual Studio (2005 or 2008): the express editions are available for free. 1. Install Visual Studio. 2. 2. Download OpenCV and install: http://sourceforge.net/project/showfiles.php? group_id=22870 . 3. See the samples folder in Start>OpenCV>Samples. Play with some executables. 4. To learn about OpenCV, read the wiki or the CVPR course on the sourceforge website. 5. Attempt to open an image, display it and close it by writing your own program. The following pictures will guide you on how to do the last step above. Start Visual Studio and use the menu command shown below to create a new project.

Getting Started with OpenCV Using Visual Studio - ac · PDF fileGetting Started with OpenCV Using Visual Studio ... you will be able to create a console application with Visual Studio

Embed Size (px)

Citation preview

Page 1: Getting Started with OpenCV Using Visual Studio - ac · PDF fileGetting Started with OpenCV Using Visual Studio ... you will be able to create a console application with Visual Studio

Getting Started with OpenCV Using Visual Studio Using this pictorial guide, you will be able to create a console application with Visual Studio using OpenCV computer vision library. You will need to install Visual Studio (2005 or 2008): the express editions are available for free.

1. Install Visual Studio.

2. 2. Download OpenCV and install: http://sourceforge.net/project/showfiles.php?group_id=22870.

3. See the samples folder in Start>OpenCV>Samples. Play with some executables.

4. To learn about OpenCV, read the wiki or the CVPR course on the sourceforge website.

5. Attempt to open an image, display it and close it by writing your own program.

The following pictures will guide you on how to do the last step above.

Start Visual Studio and use the menu command shown below to create a new project.

Page 2: Getting Started with OpenCV Using Visual Studio - ac · PDF fileGetting Started with OpenCV Using Visual Studio ... you will be able to create a console application with Visual Studio

Select the Win32 Console Application. Type a name for the project and the solution. Click Next.

Select Empty Project and click finish.

Page 3: Getting Started with OpenCV Using Visual Studio - ac · PDF fileGetting Started with OpenCV Using Visual Studio ... you will be able to create a console application with Visual Studio

A project within the solution will be created.

Right click the project and select Add>New Item to add new code.

Page 4: Getting Started with OpenCV Using Visual Studio - ac · PDF fileGetting Started with OpenCV Using Visual Studio ... you will be able to create a console application with Visual Studio

Slect Code>C++ File (.cpp). Give a file name

Now you can type in code.

Page 5: Getting Started with OpenCV Using Visual Studio - ac · PDF fileGetting Started with OpenCV Using Visual Studio ... you will be able to create a console application with Visual Studio

After you type in your code, you can build.

In order to use OpenCV you should add the header file folder,

Adding Header File Folders (Once)

Page 6: Getting Started with OpenCV Using Visual Studio - ac · PDF fileGetting Started with OpenCV Using Visual Studio ... you will be able to create a console application with Visual Studio

Include the Include File Directories

For every project include cv, cxcore, highgui and optionally ml include folders.

Page 7: Getting Started with OpenCV Using Visual Studio - ac · PDF fileGetting Started with OpenCV Using Visual Studio ... you will be able to create a console application with Visual Studio

Add the Library File folder.

Open the project properties window to add the library files.

Page 8: Getting Started with OpenCV Using Visual Studio - ac · PDF fileGetting Started with OpenCV Using Visual Studio ... you will be able to create a console application with Visual Studio

Select project properties and add the libraries: cxcore.lib, cv.lib, highgui.lib, and optionally ml.lib.

You may need to setup the system path as well for the system to find the DLLs.

Page 9: Getting Started with OpenCV Using Visual Studio - ac · PDF fileGetting Started with OpenCV Using Visual Studio ... you will be able to create a console application with Visual Studio

Images that you use should be located along with your .cpp files, unless you specify the path within your code.