sexta-feira, 28 de fevereiro de 2014

Simple EmguCV (OpenCV) on C#


Now it 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.


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:
// 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);
Now press F5 and then there should be a Window.

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


  • First post

quinta-feira, 6 de fevereiro de 2014