Tutorial: Difference between revisions
mNo edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
===Emgu=== | ===Emgu=== | ||
All libraries provided by Emgu | All libraries provided by Emgu™ use the namespace Emgu. | ||
===Emgu.CV=== | ===Emgu.CV=== | ||
Line 8: | Line 8: | ||
==== Emgu.CV.CvInvoke class ==== | ==== Emgu.CV.CvInvoke class ==== | ||
This class is written to provided a way to directly invoke opencv function within .NET languages. Each method in this class corresponds to the same function in opencv. For example, a call to <code> CvInvoke.cvCreateImage(new MCvSize(400, 300), CvEnum.IPL_DEPTH.IPL_DEPTH_8U, 1); </code> is equivalent to the function in | This class is written to provided a way to directly invoke opencv function within .NET languages. Each method in this class corresponds to the same function in opencv. For example, a call to <code> CvInvoke.cvCreateImage(new MCvSize(400, 300), CvEnum.IPL_DEPTH.IPL_DEPTH_8U, 1); </code> is equivalent to the function call in opencv <code> cvCreateImage(cvSize(400, 300), IPL_DEPTH_8U, 1); </code>. Both of which create a 400x300 single-channel image of 8-bit depth. | ||
==== Emgu.CV.CvEnum namespace ==== | ==== Emgu.CV.CvEnum namespace ==== | ||
This namespace provides direct mapping to opencv enumerations. For example, <code> CvEnum.IPL_DEPTH.IPL_DEPTH_8U </code> is equivalent to the value in | This namespace provides direct mapping to opencv enumerations. For example, <code> CvEnum.IPL_DEPTH.IPL_DEPTH_8U </code> is equivalent to the value in opencv <code> IPL_DEPTH_8U </code>. Both of which equals <code>8</code>. | ||
==== Emgu.CV.Mxxx Structure ==== | ==== Emgu.CV.Mxxx Structure ==== | ||
This type of structure is a direct mapping to opencv structures. For example | This type of structure is a direct mapping to opencv structures. For example | ||
*<code> MIplImage </code> is equivalent to <code> IplImage </code> structure in opencv | |||
*<code> MCvMat</code> is equivalent to <code>CvMat</code> structure | |||
*<code> Mxxxx </code> is equivalent to <code>xxxx</code> structure | |||
==Working with images== | |||
===Creating Image=== | |||
Although it is possible to create image by calling <code>CvInvoke.cvCreateImage</code>, we suggest using the generic class Image<C, D> for image creation. There are serveral advantage of using the Managed Image<Color, Depth> class, among those are | |||
* Memory is gaurantee to be release when the garbage collector dispose the Image<Color, Depth> Object | |||
* Image<Color, Depth> class contains advanced method that is not available on OpenCV, for example, generic operation | |||
===Image Color=== | |||
Image Color is specified using the first generic parameter <code>Color</code> | |||
Available Color Types are: | |||
* Gray | |||
* Bgr (Blue Green Red) | |||
* Hsv (Hue Satuation value) | |||
===Image Depth=== | |||
Image Depth is specified using the second generic parameter <code>Depth</code> | |||
Available Color Depths are: | |||
* Byte | |||
* Single (float) |
Revision as of 21:21, 25 February 2008
Namespace
Emgu
All libraries provided by Emgu™ use the namespace Emgu.
Emgu.CV
The Emgu.CV namespace implement wrapper functions for OpenCV
Emgu.CV.CvInvoke class
This class is written to provided a way to directly invoke opencv function within .NET languages. Each method in this class corresponds to the same function in opencv. For example, a call to CvInvoke.cvCreateImage(new MCvSize(400, 300), CvEnum.IPL_DEPTH.IPL_DEPTH_8U, 1);
is equivalent to the function call in opencv cvCreateImage(cvSize(400, 300), IPL_DEPTH_8U, 1);
. Both of which create a 400x300 single-channel image of 8-bit depth.
Emgu.CV.CvEnum namespace
This namespace provides direct mapping to opencv enumerations. For example, CvEnum.IPL_DEPTH.IPL_DEPTH_8U
is equivalent to the value in opencv IPL_DEPTH_8U
. Both of which equals 8
.
Emgu.CV.Mxxx Structure
This type of structure is a direct mapping to opencv structures. For example
MIplImage
is equivalent toIplImage
structure in opencvMCvMat
is equivalent toCvMat
structureMxxxx
is equivalent toxxxx
structure
Working with images
Creating Image
Although it is possible to create image by calling CvInvoke.cvCreateImage
, we suggest using the generic class Image<C, D> for image creation. There are serveral advantage of using the Managed Image<Color, Depth> class, among those are
- Memory is gaurantee to be release when the garbage collector dispose the Image<Color, Depth> Object
- Image<Color, Depth> class contains advanced method that is not available on OpenCV, for example, generic operation
Image Color
Image Color is specified using the first generic parameter Color
Available Color Types are:
- Gray
- Bgr (Blue Green Red)
- Hsv (Hue Satuation value)
Image Depth
Image Depth is specified using the second generic parameter Depth
Available Color Depths are:
- Byte
- Single (float)