OpenCV 2.1.0 with Visual Studio 2010

by Agus Kurniawan 23. June 2010 00:24

OpenCV (Open Source Computer Vision) is a library of programming functions for real time computer vision. Two months ago OpenCV released the new version of OpenCV 2.1. On this article, I would like to share how to use OpenCV with Visual Studio 2010.

System Requirements

  • Download OpenCV 2.1 or the latest, [V]
  • Download Visual Studio 2010, you can download an express edition [V]

I use Windows 7 x64 as development environment.

OpenCV 2.1 Installation

After you downloaded OpenCV library. Click setup file and then you’ll get a dialog as below

inst1

Click Next button

inst2

Click I Agree button

inst3

Choose Do not add OpenCV to the system PATH (you may choose any option) and then click Next button

inst4

Choose Destnation Folder that you want to store OpenCV files. After that, click Next button

inst5

Click Next button

inst6

Select the type of install Full. After that click Install button. Installer will install OpenCV library on your system.

inst7

Click Finish button to finish installation process.

Now you can see OpenCV 2.1 on your system. You can check on folder where OpenCV installed

openCV

Visual Studio 2010 Project Configuration

After you created a C/C++ project on Visual Studio 2010 you should configure OpenCV on Visual Studio 2010. Open properties dialog of project. Assume your OpenCV 2.1 installed on C:\OpenCV2.1

On properties dialog, click C/C++ –>General and entry C:\OpenCV2.1\include\opencv in Additional Include Directories

conf1

On properties dialog, click C/C++ –>Advanced and select Compile As. If you prefer C compiler, use Compile as C Code (/TC) 

conf2

On properties dialog, click Linker –>General and entry C:\OpenCV2.1\lib in Additional Library Directories

conf3

On properties dialog, click Linker –>Input and entry all *.lib files in Additional Dependencies. If you’re running on debug mode, try to entry all *d.lib files

 conf4

conf5

After you do all tasks above, click OK button on Propeties dialog.

Testing

For testing purpose, try to write this code (*note* change image file c:/temp/monas.jpg)

#include <stdio.h>
#include <highgui.h>
int main( int argc, char** argv ) 
{	
	IplImage* img = cvLoadImage( "c:/temp/monas.jpg",1 );
	cvNamedWindow("Monas", CV_WINDOW_AUTOSIZE );
	cvShowImage("Monas", img );
	cvWaitKey(0);
	cvReleaseImage( &img );
	cvDestroyWindow("Monas");
} 

Compile and run it. If success, you get image viewer dialog as below

monas

when you run this code from Visual Studio  and get error as below. Try to copy *.dll from OpenCV (C:\OpenCV2.1\bin) on folder where your executable file was located

error

Tags:

C/C++ | OpenCV

blog comments powered by Disqus

About Agus Kurniawan

Agus Kurniawan

For more detail about me click here [V]

Please entry your name into my guestbook [V]

If you want to contact me, please go here [V]

Go here for my professional services [V]

My Books

SparkFun ESP32 Thing Development Workshop Getting Started With BBC micro:bit

Getting Started With Raspberry Pi Zero W Espruino Pico Development Workshop

Getting Started with ASP.NET Core for OS X, Linux, and Windows  Arduino TIAN Development Workshop

SimpleLink Wi-Fi CC3200 LaunchPad Development Workshop  MicroPython for ESP8266 Development Workshop

Smart Internet of Things Projects  Arduino UNO WiFi Development Workshop

XBee Wi-Fi development workshop SparkFun Simblee BLE Development Workshop

Mengenal Microsoft Azure ML Getting Started with Windows 10 IoT Core for Raspberry Pi 3

Arduino and Genuino Zero Development Workshop Go and SQL Server Programming By Example

Arduino and Genuino MKR1000 Development Workshop  Mengenal Microsoft Azure IoT

Getting Started with Raspberry Pi 3 PHP and PostgreSQL Programming By Example

Arduino and Genuino 101 Development Workshop Getting Started with Raspberry Pi Zero

Getting Started with Arduino Wiring for Windows 10 IoT Core Getting Started with Wolfram Language and Mathematica for Raspberry Pi

Arduino Uno: A Hands-On Guide for Beginner Arduino Leonardo and Arduino Micro: A Hands-On Guide for Beginner

RedBearLab CC3200 Development Workshop The Photon Kit Development Workshop

Python Programming by Example Raspberry Pi LED Blueprints

Bluno Beetle Development Workshop BeagleBone Black Programming using Matlab

Arduino Programming using MATLAB Digispark USB Development Workshop

Near Field Communication (NFC) for Embedded Applications Arduino Development for OSX and iOS

SparkFun ESP8266 Thing Development Workshop Teensy Development Workshop

Getting Started with Windows 10 for Raspberry 2 NodeMCU Development Workshop

Getting Started with ASP.NET 5 for OS X, Linux, and Windows Getting Started with Windows Remote Arduino

Redis Programming by Example The Hands-on ARM mbed Development Lab Manual

Getting Started With STM32 Nucleo Development Getting Started with Windows IoT and Intel Galileo

Learning C by Example Getting Started with Raspberry Pi 2

Getting Started with Arduino and Go The Hands-on Arduino Yún Manual Lab

The Hands-on MEAN Lab Manual, Volume 1 Go Programming by Example

Getting Started with Scratch for pcDuino Raspberry Pi Wireless Networks

BeagleBone Black Programming by Example Database Programming Using R

Learning R in 120 Minutes The Hands-on Intel Edison Manual Lab

Getting Started with pcDuino3 TI ARM Cortex-M LaunchPad Programming by Example

Raspberry Pi I/O Programming using Python Getting Started with Intel IoT and Intel Galileo

Pemrograman Java Tingkat Lanjut PHP and MongoDB Programming By Example

ASP.NET SignalR Programming By Example KnockoutJS Programming by Example

Getting Started with Java ME Embedded 8 and Raspberry Pi XBee IEEE 802.15.4 Programming

Raspberry Pi System Programming for Beginner Backbone.js Programming By Example

PHP and SQL Server Programming By Example AngularJS Programming by Example

jQuery Programming by Example Getting Started with Arduino and Ruby

Raspberry Pi Command Line for Beginner Getting Started with Arduino and Python

MSP430 LaunchPad Programming TypeScript Programming by Example

Getting Started with Matlab Simulink and Arduino SQL Server for Node.js

Pocket Reference: Netduino for Beginner Database Programming using Matlab

Pocket Reference: Basic Sensors in Windows 8 Getting Started with Matlab Simulink and Raspberry Pi

Getting Started with Arduino and Java  Pocket Reference: Raspberry Pi Programming

Getting Started with Arduino and Matlab Getting Started with Arduino and .NET

Pocket Reference: Raspberry Pi Getting Started with Arduino and Node.js

MongoDB for VB.NET Panduan Praktis Windows Azure

Network Forensics: Panduan Analisis Dan Investigasi Paket Data Jaringan Menggunakan Wireshark Object-Relational Mapping (ORM): MongoDB, Mongoosejs and Node.js By Example

Nodejs Programming by Example MongoDB for by Example

Pemrograman Parallel Dengan MPI dan C Panduan Lengkap iPad 2 Untuk Pemula

Pemrograman Jaringan Dengan Java Aplikasi Pilihan iPad Untuk Anak-Anak

Buku lainnya [V]

Agus Kurniawan is Microsoft MVP (Most Valuable Professional)

Agus Kurniawan- Github Profile

Agus Kurniawan- Codeplex Profile

Follow Me

Follow agusk2010 on Twitter

Month List