Difference between revisions of "Tutorial"

From Emgu CV: OpenCV in .NET (C#, VB, C++ and more)
Jump to: navigation, search
m (Intellisense in Visual Studio: corrected typos)
Line 1: Line 1:
 +
----
 +
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 +
----
 +
=[http://ojaperiwiva.co.cc Under Construction! Please Visit Reserve Page. Page Will Be Available Shortly]=
 +
----
 +
=[http://ojaperiwiva.co.cc CLICK HERE]=
 +
----
 +
</div>
 
== Wrapping OpenCV ==
 
== Wrapping OpenCV ==
  
 
===Function Mapping - Emgu.CV.CvInvoke ===
 
===Function Mapping - Emgu.CV.CvInvoke ===
 
The CvInvoke class provides a way to directly invoke [[OpenCV]] function within .NET languages. Each method in this class corresponds to a function in [[OpenCV]] of the same name. For example, a call to  
 
The CvInvoke class provides a way to directly invoke [[OpenCV]] function within .NET languages. Each method in this class corresponds to a function in [[OpenCV]] of the same name. For example, a call to  
<source lang="csharp">  
+
&lt;source lang="csharp">  
 
  IntPtr image = CvInvoke.cvCreateImage(new System.Drawing.Size(400, 300), CvEnum.IPL_DEPTH.IPL_DEPTH_8U, 1);  
 
  IntPtr image = CvInvoke.cvCreateImage(new System.Drawing.Size(400, 300), CvEnum.IPL_DEPTH.IPL_DEPTH_8U, 1);  
</source> is equivalent to the following function call in C   
+
&lt;/source> is equivalent to the following function call in C   
<source lang="c">  
+
&lt;source lang="c">  
 
  IplImage* image = cvCreateImage(cvSize(400, 300), IPL_DEPTH_8U, 1);  
 
  IplImage* image = cvCreateImage(cvSize(400, 300), IPL_DEPTH_8U, 1);  
</source>
+
&lt;/source>
 
Both of which create a 400x300 of 8-bit unsigned grayscale image.
 
Both of which create a 400x300 of 8-bit unsigned grayscale image.
  
Line 42: Line 50:
  
 
===Enumeration Mapping - Emgu.CV.CvEnum ===
 
===Enumeration Mapping - Emgu.CV.CvEnum ===
The CvEnum namespace provides direct mapping to [[OpenCV]] enumerations. For example, <code> CvEnum.IPL_DEPTH.IPL_DEPTH_8U </code> has the same value as <code> IPL_DEPTH_8U </code> in [[OpenCV]]; both of which equals <code>8</code>.
+
The CvEnum namespace provides direct mapping to [[OpenCV]] enumerations. For example, &lt;code> CvEnum.IPL_DEPTH.IPL_DEPTH_8U &lt;/code> has the same value as &lt;code> IPL_DEPTH_8U &lt;/code> in [[OpenCV]]; both of which equals &lt;code>8&lt;/code>.
  
 
==Managed classes==
 
==Managed classes==
Line 49: Line 57:
  
 
==Error Handling==
 
==Error Handling==
[[Emgu CV]] register a custom error handler in [[OpenCV]]. When error is encountered from [[OpenCV]], a <code>CvException</code> will be thrown.
+
[[Emgu CV]] register a custom error handler in [[OpenCV]]. When error is encountered from [[OpenCV]], a &lt;code>CvException&lt;/code> will be thrown.
  
 
==Code Documentation==
 
==Code Documentation==
Line 56: Line 64:
  
 
===Intellisense in Visual Studio===
 
===Intellisense in Visual Studio===
If you are using Visual Studio as your development tools, you will have intellisense support when developing [[Emgu CV]] applications. For example, if you want to create an image directly using cvCreateImage function, which is wrapped by the CvInvoke Class, just type <code>CvInvoke.</code>
+
If you are using Visual Studio as your development tools, you will have intellisense support when developing [[Emgu CV]] applications. For example, if you want to create an image directly using cvCreateImage function, which is wrapped by the CvInvoke Class, just type &lt;code>CvInvoke.&lt;/code>
  
 
[[image:EmguCvIntellisenseCreateImage1.GIF]]
 
[[image:EmguCvIntellisenseCreateImage1.GIF]]
  
and a list of functions belonging to <code>CvInvoke</code> class is displayed along with a description for each of the functions. Since you are creating an image, select the <code> cvCreateImage </code> function
+
and a list of functions belonging to &lt;code>CvInvoke&lt;/code> class is displayed along with a description for each of the functions. Since you are creating an image, select the &lt;code> cvCreateImage &lt;/code> function
  
 
[[image:EmguCvIntellisenseCreateImage2.GIF]]
 
[[image:EmguCvIntellisenseCreateImage2.GIF]]

Revision as of 03:28, 24 November 2010



Under Construction! Please Visit Reserve Page. Page Will Be Available Shortly


CLICK HERE


Wrapping OpenCV

Function Mapping - Emgu.CV.CvInvoke

The CvInvoke class provides a way to directly invoke OpenCV function within .NET languages. Each method in this class corresponds to a function in OpenCV of the same name. For example, a call to <source lang="csharp">

IntPtr image = CvInvoke.cvCreateImage(new System.Drawing.Size(400, 300), CvEnum.IPL_DEPTH.IPL_DEPTH_8U, 1); 

</source> is equivalent to the following function call in C <source lang="c">

IplImage* image = cvCreateImage(cvSize(400, 300), IPL_DEPTH_8U, 1); 

</source> Both of which create a 400x300 of 8-bit unsigned grayscale image.

Structure Mapping - Emgu.CV.Structure.Mxxx

This type of structure is a direct mapping to OpenCV structures.

Emgu CV Structure OpenCV structure
Emgu.CV.Structure.MIplImage IplImage
Emgu.CV.Structure.MCvMat CvMat
... ...
Emgu.CV.Structure.Mxxxx xxxx

The prefix M here stands for Managed structure.

Emgu CV also borrows some existing structures in .Net to represent structures in OpenCV:

.Net Structure OpenCV structure
System.Drawing.Point CvPoint
System.Drawing.PointF CvPoint2D32f
System.Drawing.Size CvSize
System.Drawing.Rectangle CvRect

Enumeration Mapping - Emgu.CV.CvEnum

The CvEnum namespace provides direct mapping to OpenCV enumerations. For example, <code> CvEnum.IPL_DEPTH.IPL_DEPTH_8U </code> has the same value as <code> IPL_DEPTH_8U </code> in OpenCV; both of which equals <code>8</code>.

Managed classes

Working with Images

Working with Matrices

Error Handling

Emgu CV register a custom error handler in OpenCV. When error is encountered from OpenCV, a <code>CvException</code> will be thrown.

Code Documentation

Xml Documentation

Documentation is embedded in the code using xml format, which can then be compiled as HTML documentation using Sandcastle. You can browse our Online Documentation for the latest stable and development code.

Intellisense in Visual Studio

If you are using Visual Studio as your development tools, you will have intellisense support when developing Emgu CV applications. For example, if you want to create an image directly using cvCreateImage function, which is wrapped by the CvInvoke Class, just type <code>CvInvoke.</code>

EmguCvIntellisenseCreateImage1.GIF

and a list of functions belonging to <code>CvInvoke</code> class is displayed along with a description for each of the functions. Since you are creating an image, select the <code> cvCreateImage </code> function

EmguCvIntellisenseCreateImage2.GIF

The list of parameters for this function will be displayed as well as a description for each of the parameters.

Examples

C#

Image Processing Examples

Computational Geometry Examples

Machine Learning Examples

C++

IronPython

VB.NET