The tutorial is obsolete. Use CMake and the script OpenCVConfig.cmake to generate solutions for Visual Studio

OpenCV-2.1.0 Visual C++ 2010 on Windows 7

(Verified on Windows 7 x86_64; Should also be compatible with Windows XP SP3 and newer)

This tutorial will walk the user through setup of an OpenCV project in Microsoft Visual C++ 2010 (VS 2010 Professional and Visual C++ 2010 Express ). There is a small 'Hello World' example at the end.

This guide is adapted from the Microsoft Visual C++ 2010 Express, part of MSVS 2010 Express guide.

Installation Pre-Requisites

  1. Microsoft Visual Studio 2010 Professional (paid) or Microsoft Visual C++ 2010 Express Edition (free).

    1. Note: This guide applies to both the Studio and Express Editions.
  2. OpenCV 2.1.0 Windows Executable Install

    1. Note: File listed as for VS2008, but works for 2010 as well.

OpenCV 2.1.0 HelloWorld

new_project.JPG new_project_template.JPG

helloworld_properties.JPG helloworld_linker.JPG

// OpenCV_Helloworld.cpp : Defines the entry point for the console application.
// Created for build/install tutorial, Microsoft Visual C++ 2010 Express and OpenCV 2.1.0

#include "stdafx.h"

#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

int _tmain(int argc, _TCHAR* argv[])
{
        IplImage *img = cvLoadImage("funny-pictures-cat-goes-pew.jpg");
        cvNamedWindow("Image:",1);
        cvShowImage("Image:",img);

        cvWaitKey();
        cvDestroyWindow("Image:");
        cvReleaseImage(&img);

        return 0;
}

helloworld_final.JPG

OpenCVWiki: VisualC++_VS2010 (last edited 2011-11-08 16:48:27 by vpisarev)