Click here to Skip to main content
15,891,253 members
Articles / Programming Languages / C#
Tip/Trick

Simple EmguCV (OpenCV) on C#

Rate me:
Please Sign up or sign in to vote.
4.60/5 (6 votes)
23 Feb 2014CPOL1 min read 62.5K   17   6
A simple method to get EmguCV (OpenCV) running in a .NET application

Introduction

Now it has became easier to use OpenCV on C#.
In this tip, I propose a simple method to get EmguCV* (OpenCV) running in a .NET application, using a NuGet package called myEmguCV.Net.

This is a NuGet package that makes it easy to start an application with EmguCV.

* This version uses EmguCV wrapper for x86 version of OpenCV.

Background

It was often difficult to use OpenCV in C#, although you can download EmguCV, and follow the steps listed on EmguCV website, it was not the simplest task.
Until now.
I have created a NuGet package containing all DLLs from EmguCV and OpenCV, so all you need to do is: on Visual Studio Express, add this Package to your Solution, add some sample code, and Run.

Overview of the Steps

  1. Just create a new Visual Studio Express solution
  2. Add the NuGet package myEmguCV.Net
  3. Add sample code
  4. Press F5 (Run)

Installing the NuGet Package

  • Right click the References
  • Select Manage NuGet packages
  • Search for myEmguCV.Net
  • Click Install
  • Wait for download and installation to finish

Writing Code

After adding the myEmguCV.Net package, you can run some code for Computer Vision tasks:

For example, something like this:

C#
using Emgu.CV;
using Emgu.CV.Structure;
//...

// Sample
Image<Hsv, byte> bitmap = new Image<Hsv, byte>(@"C:\temp\LicensePlate.bmp");

Hsv lowerLimit = new Hsv(0, 0, 200);
Hsv upperLimit = new Hsv(5, 255, 255);

var imageHSVDest = bitmap.InRange(lowerLimit, upperLimit);

CvInvoke.cvShowImage("imageHSVDest", imageHSVDest);
CvInvoke.cvWaitKey(0);

Now press F5 and then there should be a OpenCV Window with the processed output image.

Learn More

For examples of How to Use see this website, you can check out the following link:

Points of Interest

This is a complete package containing binary DLLs, about 131MB.

Includes binaries of: OpenCV, EmguCV for .NET, x86 version

One requirement is to have installed MSVCRT 9.0 SP1 x86

History

  • First post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO
Brazil Brazil
I am a software developer since 1998. Currently working with C#, WPF, ASP.Net, Microsoft Visual Studio 2013, MySQL.

Our Lady is appearing here in Brazil since 1987 to Pedro Régis.
See the messages and prophecies on the website Apelos Urgentes www.apelosurgentes.com.br/english

Comments and Discussions

 
Questionit works! thank you! Pin
elevator114-Sep-17 4:28
elevator114-Sep-17 4:28 
BugGetting Error for Android Pin
Rizwan Asif18-Apr-17 22:34
Rizwan Asif18-Apr-17 22:34 
GeneralRe: Getting Error for Android Pin
Rizwan Asif18-Apr-17 22:43
Rizwan Asif18-Apr-17 22:43 
QuestionCan't find the download Pin
descartes23-Feb-14 9:49
descartes23-Feb-14 9:49 
AnswerRe: Can't find the download Pin
TonyBR23-Feb-14 18:20
TonyBR23-Feb-14 18:20 
GeneralRe: Can't find the download Pin
descartes23-Feb-14 22:20
descartes23-Feb-14 22:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.