c# opencv
c#用 opencv 必须封装为dll,还要定义繁多的结构体,最近出现了csharp opencv。不知道和open cv差距有多大。
下面是搜到的一c#定义opencv的结构体的代码。
// CSharpOpenCV - CSharp Project
// -----------------
// Copyright (C) 2005 LABMETRO/EMC/UFSC
// LABMETRO - Laboratory for Metrology and Automatization
// EMC - Mechanical Engineering Department
// UFSC - Federal University of Santa Catarina
// -----------------
// http://labmetro.ufsc.br/
//
//
// FILE:
// CSharpOpenCV.cs
//
// MODULE:
// CSharpOpenCV
//
// PURPOUSE:
// Implementation of a wrapper class to import the OpenCV functionalities
// to the CSharp programming language.
//
// AUTHORS:
// Alberto Xavier Pavim (axp)
//
// USAGE:
// This class' fucntionalities may be called into user applications to perform
// image acquisition and processing tasks.
//
// STATUS:
// Compiling and working
//
// VERSIONS:
// <DATE> <EXPLANATION_OF_IMPORTANT_MODIFICATION/UPDATE> (<AUTHOR_ID>)
// 10.07.06 Creating the structure of the wrapper class (axp)
// 03.10.06 Starting the migration to version 0.99 of OpenCV (axp)
//
// Doxygen file documentation
/**
* file CSharpOpenCV.cs
* rief Contais a wrapper class to import the OpenCV functionalities to the CSharp programming language
**/
// System Libraries
using System;
using System.Runtime.InteropServices;
using System.Security;
/// This namespace defines the scope for the OpenCV library CSharp wrapper
/**
* This namespace joins many of the OpenCV library functionalities imported to
* the CSharp programming language throug a wrapper class.
**/
namespace OpenCV
{
/// The CSharpOpenCV class is a wrapper to import the OpenCV fucntionalities into CSharp
public class CSharpOpenCV
{
//----------------------
#region Class Attributes
//---------------------------------
#region OpenCV Constant Definitions
// Remember to pass the "GnuLinux" define symbol to the compiler,
// if this source code should be included
#if GnuLinux // OpenCV library names for the GNU/Linux platform
/// Name of the cxcore OpenCV library in the GNU/Linux platform
protected const string m_sCxCoreLibName = "libcxcore.so";
/// Name of the cv OpenCV library in the GNU/Linux platform
protected const string m_sCVLibName = "libcv.so";
/// Name of the ml OpenCV library in the GNU/Linux platform
protected const string m_sMlLibName = "libml.so";
/// Name of the highgui OpenCV library in the GNU/Linux platform
protected const string m_sHighGuiLibName = "libhighgui.so";
/// Name of the cvaux OpenCV library in the GNU/Linux platform
protected const string m_sCvAuxLibName = "libcvaux.so";
#endif
// Remember to pass the "Windows" define symbol to the compiler,
// if this source code should be included
#if Windows // OpenCV library names for the Windows platform
/// Name of the cxcore OpenCV library in the Windows platform
protected const string m_sCxCoreLibName = "cxcore100.dll";
//protected const string m_sCxCoreLibName = "cxcore099.dll";
//protected const string m_sCxCoreLibName = "cxcore097.dll";
/// Name of the cv OpenCV library in the Windows platform
protected const string m_sCVLibName = "cv100.dll";
//protected const string m_sCVLibName = "cv099.dll";
//protected const string m_sCVLibName = "cv097.dll";
/// Name of the ml OpenCV library in the Windows platform
protected const string m_sMlLibName = "ml100.dll";
//protected const string m_sMlLibName = "ml099.dll";
/// Name of the highgui OpenCV library in the Windows platform
protected const string m_sHighGuiLibName = "highgui100.dll";
//protected const string m_sHighGuiLibName = "highgui099.dll";
//protected const string m_sHighGuiLibName = "highgui097.dll";
/// Name of the cvaux OpenCV library in the Windows platform
protected const string m_sCvAuxLibName = "cvaux100.dll";
//protected const string m_sCvAuxLibName = "cvaux099.dll";
//protected const string m_sCvAuxLibName = "cvaux097.dll";
#endif
/// PI definition
public const double CV_PI = 3.1415926535897932384626433832795;
/// Hough algorithm flags
public const int CV_HOUGH_STANDARD = 0;
public const int CV_HOUGH_PROBABILISTIC = 1;
public const int CV_HOUGH_MULTI_SCALE = 2;
public const int CV_HOUGH_GRADIENT = 3;
/// FloodFill segmentation flags
public const int CV_FLOODFILL_FIXED_RANGE = (1 << 16);
public const int CV_FLOODFILL_MASK_ONLY = (1 << 17);
/// Smoothing filter flags
public const int CV_BLUR_NO_SCALE = 0;
public const int CV_BLUR = 1;
public const int CV_GAUSSIAN = 2;
public const int CV_MEDIAN = 3;
public const int CV_BILATERAL = 4;
/// Events
public const int CV_EVENT_MOUSEMOVE = 0;
public const int CV_EVENT_LBUTTONDOWN = 1;
public const int CV_EVENT_RBUTTONDOWN = 2;
public const int CV_EVENT_MBUTTONDOWN = 3;
public const int CV_EVENT_LBUTTONUP = 4;
public const int CV_EVENT_RBUTTONUP = 5;
public const int CV_EVENT_MBUTTONUP = 6;
public const int CV_EVENT_LBUTTONDBLCLK = 7;
public const int CV_EVENT_RBUTTONDBLCLK = 8;
public const int CV_EVENT_MBUTTONDBLCLK = 9;
public const int CV_EVENT_FLAG_LBUTTON = 1;
public const int CV_EVENT_FLAG_RBUTTON = 2;
public const int CV_EVENT_FLAG_MBUTTON = 4;
public const int CV_EVENT_FLAG_CTRLKEY = 8;
public const int CV_EVENT_FLAG_SHIFTKEY = 16;
public const int CV_EVENT_FLAG_ALTKEY = 32;
/// Fonts
public const int CV_FONT_HERSHEY_SIMPLEX = 0;
public const int CV_FONT_HERSHEY_PLAIN = 1;
public const int CV_FONT_HERSHEY_DUPLEX = 2;
public const int CV_FONT_HERSHEY_COMPLEX = 3;
public const int CV_FONT_HERSHEY_TRIPLEX = 4;
public const int CV_FONT_HERSHEY_COMPLEX_SMALL = 5;
public const int CV_FONT_HERSHEY_SCRIPT_SIMPLEX = 6;
public const int CV_FONT_HERSHEY_SCRIPT_COMPLEX = 7;
public const int CV_FONT_ITALIC = 16;
public const int CV_FONT_VECTOR0 = CV_FONT_HERSHEY_SIMPLEX;
/// Drawing flags
public const int CV_FILLED = -1;
public const int CV_AA = 16;
/// Matrix linear algebra flags
public const int CV_LU = 0;
public const int CV_SVD = 1;
public const int CV_SVD_SYM = 2;
/// Array normalization flags
public const int CV_C = 1;
public const int CV_L1 = 2;
public const int CV_L2 = 4;
public const int CV_NORM_MASK = 7;
public const int CV_RELATIVE = 8;
public const int CV_DIFF = 16;
public const int CV_DIFF_C = (CV_DIFF | CV_C);
public const int CV_DIFF_L1 = (CV_DIFF | CV_L1);
public const int CV_DIFF_L2 = (CV_DIFF | CV_L2);
public const int CV_RELATIVE_C = (CV_RELATIVE | CV_C);
public const int CV_RELATIVE_L1 = (CV_RELATIVE | CV_L1);
public const int CV_RELATIVE_L2 = (CV_RELATIVE | CV_L2);
/// Histogram flags
public const uint CV_HIST_MAGIC_VAL = 0x42450000;
public const uint CV_HIST_UNIFORM_FLAG = (1 << 10);
public const uint CV_HIST_RANGES_FLAG = (1 << 11);
public const int CV_HIST_ARRAY = 0;
public const int CV_HIST_SPARSE = 1;
public const int CV_HIST_TREE = CV_HIST_SPARSE;
public const int CV_HIST_UNIFORM = 1;
/// Bit depth of image elements
public const uint IPL_DEPTH_SIGN = 0x80000000;
public const int IPL_DEPTH_1U = 1;
public const int IPL_DEPTH_8U = 8;
public const int IPL_DEPTH_16U = 16;
public const int IPL_DEPTH_32F = 32;
public const int IPL_DEPTH_64F = 64;
public const int IPL_DEPTH_8S = -2147483640; // (IPL_DEPTH_SIGN | 8)
public const int IPL_DEPTH_16S = -2147483632; // (IPL_DEPTH_SIGN |16)
public const int IPL_DEPTH_32S = -2147483616; // (IPL_DEPTH_SIGN |32)
/// Comparison flags
public const int CV_CMP_EQ = 0;
public const int CV_CMP_GT = 1;
public const int CV_CMP_GE = 2;
public const int CV_CMP_LT = 3;
public const int CV_CMP_LE = 4;
public const int CV_CMP_NE = 5;
/// Flags of filters used in Pyramid decomposition
public const int CV_GAUSSIAN_5x5 = 7;
/// Flags to define threshold modes
public const int CV_THRESH_BINARY = 0;
public const int CV_THRESH_BINARY_INV = 1;
public const int CV_THRESH_TRUNC = 2;
public const int CV_THRESH_TOZERO = 3;
public const int CV_THRESH_TOZERO_INV = 4;
public const int CV_ADAPTIVE_THRESH_MEAN_C = 0;
public const int CV_ADAPTIVE_THRESH_GAUSSIAN_C = 1;
/// Flags to define shapes
public const int CV_SHAPE_RECT = 0;
public const int CV_SHAPE_CROSS = 1;
public const int CV_SHAPE_ELLIPSE = 2;
public const int CV_SHAPE_CUSTOM = 100;
/// Flags to define mathematical morphology operations
public const int CV_MOP_OPEN = 2;
public const int CV_MOP_CLOSE = 3;
public const int CV_MOP_GRADIENT = 4;
public const int CV_MOP_TOPHAT = 5;
public const int CV_MOP_BLACKHAT = 6;
/// Error modes
public const int CV_ErrModeLeaf = 0;
public const int CV_ErrModeParent = 1;
public const int CV_ErrModeSilent = 2;
/// Flag to control maximal dimension for matrix
public const int CV_MAX_DIM = 32;
/// Flags to control termination criteria for iterative algorithms
public const int CV_TERMCRIT_ITER = 1;
public const int CV_TERMCRIT_NUMBER = CV_TERMCRIT_ITER;
public const int CV_TERMCRIT_EPS = 2;
/// Flag to adjust window size to image size
public const int CV_WINDOW_AUTOSIZE = 1;
/// Flag representing any imaging device connected to the computer
public const int CV_CAP_ANY = -1;
// Flags to control video stream capture properties
/// Flag representing the position in milliseconds from the vido stream file beginning
public const int CV_CAP_PROP_POS_MSEC = 0;
/// Flag representing the position in frames from the video stream file beginning
public const int CV_CAP_PROP_POS_FRAMES = 1;
/// Flag representing the position in relative units from the video stream file beginning
public const int CV_CAP_PROP_POS_AVI_RATIO = 2;
/// Flag representing the image frame width property
public const int CV_CAP_PROP_FRAME_WIDTH = 3;
/// Flag representing the video stream image frame height property
public const int CV_CAP_PROP_FRAME_HEIGHT = 4;
/// Flag representing the video stream image frame width property
public const int CV_CAP_PROP_FPS = 5;
/// Flag representing the video stream 4-character code of codec
public const int CV_CAP_PROP_FOURCC = 6;
/// Flag representing the number of frames in video stream file
public const int CV_CAP_PROP_FRAME_COUNT = 7;
// Flags to control image loading processing
/// Flag representing any image color (DEPRECATED BY OPENCV)
public const int CV_LOAD_IMAGE_UNCHANGED = -1;
/// Flag representing a gray image
public const int CV_LOAD_IMAGE_GRAYSCALE = 0;
/// Flag representing a colored image
public const int CV_LOAD_IMAGE_COLOR = 1;
/// Flag representing an image with any depth
public const int CV_LOAD_IMAGE_ANYDEPTH = 2;
/// Flag representing any image color (may also be modified by CV_LOAD_IMAGE_ANYDEPTH)
public const int CV_LOAD_IMAGE_ANYCOLOR = 4;
// Flags for color conversion
public const int CV_BGR2BGRA = 0;
public const int CV_RGB2RGBA = 0;
public const int CV_BGRA2BGR = 1;
public const int CV_RGBA2RGB = 1;
public const int CV_BGR2RGBA = 2;
public const int CV_RGB2BGRA = 2;
public const int CV_RGBA2BGR = 3;
public const int CV_BGRA2RGB = 3;
public const int CV_BGR2RGB = 4;
public const int CV_RGB2BGR = 4;
public const int CV_BGRA2RGBA = 5;
public const int CV_RGBA2BGRA = 5;
public const int CV_BGR2GRAY = 6;
public const int CV_RGB2GRAY = 7;
public const int CV_GRAY2BGR = 8;
public const int CV_GRAY2RGB = 8;
public const int CV_GRAY2BGRA = 9;
public const int CV_GRAY2RGBA = 9;
public const int CV_BGRA2GRAY = 10;
public const int CV_RGBA2GRAY = 11;
public const int CV_BGR2BGR565 = 12;
public const int CV_RGB2BGR565 = 13;
public const int CV_BGR5652BGR = 14;
public const int CV_BGR5652RGB = 15;
public const int CV_BGRA2BGR565 = 16;
public const int CV_RGBA2BGR565 = 17;
public const int CV_BGR5652BGRA = 18;
public const int CV_BGR5652RGBA = 19;
public const int CV_GRAY2BGR565 = 20;
public const int CV_BGR5652GRAY = 21;
public const int CV_BGR2BGR555 = 22;
public const int CV_RGB2BGR555 = 23;
public const int CV_BGR5552BGR = 24;
public const int CV_BGR5552RGB = 25;
public const int CV_BGRA2BGR555 = 26;
public const int CV_RGBA2BGR555 = 27;
public const int CV_BGR5552BGRA = 28;
public const int CV_BGR5552RGBA = 29;
public const int CV_GRAY2BGR555 = 30;
public const int CV_BGR5552GRAY = 31;
public const int CV_BGR2XYZ = 32;
public const int CV_RGB2XYZ = 33;
public const int CV_XYZ2BGR = 34;
public const int CV_XYZ2RGB = 35;
public const int CV_BGR2YCrCb = 36;
public const int CV_RGB2YCrCb = 37;
public const int CV_YCrCb2BGR = 38;
public const int CV_YCrCb2RGB = 39;
public const int CV_BGR2HSV = 40;
public const int CV_RGB2HSV = 41;
public const int CV_BGR2Lab = 44;
public const int CV_RGB2Lab = 45;
public const int CV_BayerBG2BGR = 46;
public const int CV_BayerRG2RGB = 46;
public const int CV_BayerGB2BGR = 47;
public const int CV_BayerGR2RGB = 47;
public const int CV_BayerRG2BGR = 48;
public const int CV_BayerBG2RGB = 48;
public const int CV_BayerGR2BGR = 49;
public const int CV_BayerGB2RGB = 49;
public const int CV_BGR2Luv = 50;
public const int CV_RGB2Luv = 51;
public const int CV_BGR2HLS = 52;
public const int CV_RGB2HLS = 53;
public const int CV_HSV2BGR = 54;
public const int CV_HSV2RGB = 55;
public const int CV_Lab2BGR = 56;
public const int CV_Lab2RGB = 57;
public const int CV_Luv2BGR = 58;
public const int CV_Luv2RGB = 59;
public const int CV_HLS2BGR = 60;
public const int CV_HLS2RGB = 61;
// Flags to define Matrix types
public const int CV_8U = 0;
public const int CV_8S = 1;
public const int CV_16U = 2;
public const int CV_16S = 3;
public const int CV_32S = 4;
public const int CV_32F = 5;
public const int CV_64F = 6;
public const int CV_CN_SHIFT = 3;
public const int CV_8UC1 = (CV_8U + ((1 - 1) << CV_CN_SHIFT));
public const int CV_8UC2 = (CV_8U + ((2 - 1) << CV_CN_SHIFT));
public const int CV_8UC3 = (CV_8U + ((3 - 1) << CV_CN_SHIFT));
public const int CV_8UC4 = (CV_8U + ((4 - 1) << CV_CN_SHIFT));
public const int CV_8SC1 = (CV_8S + ((1 - 1) << CV_CN_SHIFT));
public const int CV_8SC2 = (CV_8S + ((2 - 1) << CV_CN_SHIFT));
public const int CV_8SC3 = (CV_8S + ((3 - 1) << CV_CN_SHIFT));
public const int CV_8SC4 = (CV_8S + ((4 - 1) << CV_CN_SHIFT));
public const int CV_16UC1 = (CV_16U + ((1 - 1) << CV_CN_SHIFT));
public const int CV_16UC2 = (CV_16U + ((2 - 1) << CV_CN_SHIFT));
public const int CV_16UC3 = (CV_16U + ((3 - 1) << CV_CN_SHIFT));
public const int CV_16UC4 = (CV_16U + ((4 - 1) << CV_CN_SHIFT));
public const int CV_16SC1 = (CV_16S + ((1 - 1) << CV_CN_SHIFT));
public const int CV_16SC2 = (CV_16S + ((2 - 1) << CV_CN_SHIFT));
public const int CV_16SC3 = (CV_16S + ((3 - 1) << CV_CN_SHIFT));
public const int CV_16SC4 = (CV_16S + ((4 - 1) << CV_CN_SHIFT));
public const int CV_32SC1 = (CV_32S + ((1 - 1) << CV_CN_SHIFT));
public const int CV_32SC2 = (CV_32S + ((2 - 1) << CV_CN_SHIFT));
public const int CV_32SC3 = (CV_32S + ((3 - 1) << CV_CN_SHIFT));
public const int CV_32SC4 = (CV_32S + ((4 - 1) << CV_CN_SHIFT));
public const int CV_32FC1 = (CV_32F + ((1 - 1) << CV_CN_SHIFT));
public const int CV_32FC2 = (CV_32F + ((2 - 1) << CV_CN_SHIFT));
public const int CV_32FC3 = (CV_32F + ((3 - 1) << CV_CN_SHIFT));
public const int CV_32FC4 = (CV_32F + ((4 - 1) << CV_CN_SHIFT));
public const int CV_64FC1 = (CV_64F + ((1 - 1) << CV_CN_SHIFT));
public const int CV_64FC2 = (CV_64F + ((2 - 1) << CV_CN_SHIFT));
public const int CV_64FC3 = (CV_64F + ((3 - 1) << CV_CN_SHIFT));
public const int CV_64FC4 = (CV_64F + ((4 - 1) << CV_CN_SHIFT));
// Interpolation Flags
public const int CV_INTER_NN = 0;
public const int CV_INTER_LINEAR = 1;
public const int CV_INTER_CUBIC = 2;
public const int CV_INTER_AREA = 3;
public const int CV_WARP_FILL_OUTLIERS = 8;
public const int CV_WARP_INVERSE_MAP = 16;
// Flags for DFT and DCT functions
public const int CV_DXT_FORWARD = 0;
public const int CV_DXT_INVERSE = 1;
public const int CV_DXT_SCALE = 2;
public const int CV_DXT_ROWS = 4;
public const int CV_DXT_INV_SCALE = (CV_DXT_SCALE | CV_DXT_INVERSE);
public const int CV_DXT_INVERSE_SCALE = CV_DXT_INV_SCALE;
// Edges types
public const int CV_NEXT_AROUND_ORG = 0x00;
public const int CV_NEXT_AROUND_DST = 0x22;
public const int CV_PREV_AROUND_ORG = 0x11;
public const int CV_PREV_AROUND_DST = 0x33;
public const int CV_NEXT_AROUND_LEFT = 0x13;
public const int CV_NEXT_AROUND_RIGHT = 0x31;
public const int CV_PREV_AROUND_LEFT = 0x20;
public const int CV_PREV_AROUND_RIGHT = 0x02;
// Point Locations
public const int CV_PTLOC_ERROR = -2;
public const int CV_PTLOC_OUTSIDE_RECT = -1;
public const int CV_PTLOC_INSIDE = 0;
public const int CV_PTLOC_VERTEX = 1;
public const int CV_PTLOC_ON_EDGE = 2;
// Haar constants
public const int CV_HAAR_FEATURE_MAX = 3;
// Data Persistence and RTTI
public const int CV_NODE_NONE = 0;
public const int CV_NODE_INT = 1;
public const int CV_NODE_INTEGER = CV_NODE_INT;
public const int CV_NODE_REAL = 2;
public const int CV_NODE_FLOAT = CV_NODE_REAL;
public const int CV_NODE_STR = 3;
public const int CV_NODE_STRING = CV_NODE_STR;
public const int CV_NODE_REF = 4;
public const int CV_NODE_SEQ = 5;
public const int CV_NODE_MAP = 6;
public const int CV_NODE_TYPE_MASK = 7;
public const int CV_NODE_USER = 16;
public const int CV_NODE_EMPTY = 32;
public const int CV_NODE_NAMED = 64;
public const int CV_NODE_SEQ_SIMPLE = 256;
#endregion
//------------------------------------------
#region OpenCV Function Pointers (Delegates)
public delegate int CvIsInstanceFunc(IntPtr struct_ptr);
public delegate void CvReleaseFunc(ref IntPtr struct_dblptr);
public delegate IntPtr CvReadFunc(IntPtr storage, IntPtr node);
public delegate void CvWriteFunc(IntPtr storage, string name, IntPtr struct_ptr, CvAttrList attributes);
public delegate IntPtr CvCloneFunc(IntPtr struct_ptr);
public delegate int CvCmpFunc(IntPtr a, IntPtr b, IntPtr userdata);
public delegate int CvErrorCallback(int status, string func_name, string err_msg, string file_name, int line);
public delegate IntPtr CvAllocFunc(long size, IntPtr userdata);
public delegate int CvFreeFunc(IntPtr pptr, IntPtr userdata);
public delegate IntPtr Cv_iplCreateImageHeader(int a, int b, int c, IntPtr d, IntPtr e, int f, int g, int h, int i, int j, IntPtr k, IntPtr l, IntPtr m, IntPtr n);
public delegate void Cv_iplAllocateImageData(IntPtr a, int b, int c);
public delegate void Cv_iplDeallocate(IntPtr a, int b);
public delegate IntPtr Cv_iplCreateROI(int a, int b, int c, int d, int e);
public delegate IntPtr Cv_iplCloneImage(IntPtr a);
public delegate float CvDistanceFunction(IntPtr f1, IntPtr f2, IntPtr userdata);
public delegate void CvTrackbarCallback(int pos);
public delegate void CvMouseCallback(int an_event, int x, int y, int flags, IntPtr param);
#endregion
//-----------------------
#region OpenCV Structures
/// Wrapping OpenCV CvPoint Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvPoint
{
public int x; /* x-coordinate, usually zero-based */
public int y; /* y-coordinate, usually zero-based */
public CvPoint(int x, int y)
{
this.x = x;
this.y = y;
}
}
/// Wrapping OpenCV CvPoint2D32f Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvPoint2D32f
{
public float x; /* x-coordinate, usually zero-based */
public float y; /* y-coordinate, usually zero-based */
public CvPoint2D32f(float x, float y)
{
this.x = x;
this.y = y;
}
}
/// Wrapping OpenCV CvPoint3D32f Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvPoint3D32f
{
public float x; /* x-coordinate, usually zero-based */
public float y; /* y-coordinate, usually zero-based */
public float z; /* z-coordinate, usually zero-based */
public CvPoint3D32f(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
}
}
/// Wrapping OpenCV CvPoint2D64f Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvPoint2D64f
{
public double x; /* x-coordinate, usually zero-based */
public double y; /* y-coordinate, usually zero-based */
public CvPoint2D64f(double x, double y)
{
this.x = x;
this.y = y;
}
}
/// Wrapping OpenCV CvPoint3D64f Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvPoint3D64f
{
public double x; /* x-coordinate, usually zero-based */
public double y; /* y-coordinate, usually zero-based */
public double z; /* z-coordinate, usually zero-based */
public CvPoint3D64f(double x, double y, double z)
{
this.x = x;
this.y = y;
this.z = z;
}
}
/// Wrapping OpenCV CvBox2D Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvBox2D
{
public CvPoint2D32f center; /* center of the box */
public CvSize2D32f size; /* box width and length */
public float angle; /* angle between the horizontal axis and the first side (i.e. length) in degrees */
}
/// Wrapping OpenCV CvSize Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvSize
{
public int width; /* width of the rectangle */
public int height; /* height of the rectangle */
public CvSize(int width, int height)
{
this.width = width;
this.height = height;
}
}
/// Wrapping OpenCV CvSize2D32f Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvSize2D32f
{
public float width; /* width of the box */
public float height; /* height of the box */
public CvSize2D32f(float width, float height)
{
this.width = width;
this.height = height;
}
}
/// Wrapping OpenCV CvRect Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvRect
{
public int x; /* x-coordinate of the left-most rectangle corner[s] */
public int y; /* y-coordinate of the top-most or bottom-most rectangle corner[s] */
public int width; /* width of the rectangle */
public int height; /* height of the rectangle */
public CvRect(int value)
{
this.x = value;
this.y = value;
this.width = value;
this.height = value;
}
public CvRect(int x, int y, int width, int height)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
}
/// Wrapping OpenCV CvScalar Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvScalar
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public double[] val; // A container for 1-,2-,3- or 4-tuples of numbers
public CvScalar(double val0)
{
this.val = new double[4];
this.val[0] = val0;
this.val[1] = val0;
this.val[2] = val0;
this.val[3] = val0;
}
public CvScalar(double val0, double val1, double val2)
{
this.val = new double[4];
this.val[0] = val0;
this.val[1] = val1;
this.val[2] = val2;
this.val[3] = 0;
}
public CvScalar(double val0, double val1, double val2, double val3)
{
this.val = new double[4];
this.val[0] = val0;
this.val[1] = val1;
this.val[2] = val2;
this.val[3] = val3;
}
public CvScalar(CvScalar scalar)
{
this.val = new double[4];
this.val[0] = scalar.val[0];
this.val[1] = scalar.val[1];
this.val[2] = scalar.val[2];
this.val[3] = scalar.val[3];
}
}
/// Wrapping OpenCV CvTermCriteria Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvTermCriteria
{
public int type; /* a combination of CV_TERMCRIT_ITER and CV_TERMCRIT_EPS */
public int max_iter; /* maximum number of iterations */
public double epsilon; /* accuracy to achieve */
public CvTermCriteria(int type, int max_iter, double epsilon)
{
this.type = type;
this.max_iter = max_iter;
this.epsilon = epsilon;
}
}
/// Wrapping OpenCV CvMat Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvMat
{
public int type; /* CvMat signature (CV_MAT_MAGIC_VAL), element type and flags */
public int step; /* full row length in bytes */
public IntPtr refcount; /* underlying data reference counter */
public struct DataPtr
{
public IntPtr ptr;
}
public DataPtr data; /* data pointer */
public int rows; /* number of rows */
public int cols; /* number of columns */
}
/// Wrapping OpenCV CvMatND Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvMatND
{
public int type; /* CvMatND signature (CV_MATND_MAGIC_VAL), element type and flags */
public int dims; /* number of array dimensions */
public IntPtr refcount; /* underlying data reference counter */
public struct DataPtr
{
public IntPtr ptr;
}
public DataPtr data; /* data pointer */
public struct Dimension
{
public int size;
public int step;
}
[MarshalAs(UnmanagedType.ByValArray, SizeConst = CV_MAX_DIM)]
public Dimension[] dim; /* pairs (number of elements, distance between elements in bytes) for every dimension */
public CvMatND(int foo)
{
this.type = foo;
this.dims = foo;
this.refcount = IntPtr.Zero;
this.data = new DataPtr();
this.dim = new Dimension[CV_MAX_DIM];
}
}
/// Wrapping OpenCV CvSparseMat Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvSparseMat
{
public int type; /* CvSparseMat signature (CV_SPARSE_MAT_MAGIC_VAL), element type and flags */
public int dims; /* number of dimensions */
public IntPtr refcount; /* reference counter - not used */
public IntPtr heap; /* a pool of hashtable nodes */
public IntPtr hashtable; /* hashtable: each entry has a list of nodes having the same "hashvalue modulo hashsize" */
public int hashsize; /* size of hashtable */
public int total; /* total number of sparse array nodes */
public int valoffset; /* value offset in bytes for the array nodes */
public int idxoffset; /* index offset in bytes for the array nodes */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = CV_MAX_DIM)]
public int[] size; /* arr of dimension sizes */
public CvSparseMat(int foo)
{
this.type = foo;
this.dims = foo;
this.refcount = IntPtr.Zero;
this.heap = IntPtr.Zero;
this.hashtable = IntPtr.Zero;
this.hashsize = foo;
this.total = foo;
this.valoffset = foo;
this.idxoffset = foo;
this.size = new int[CV_MAX_DIM];
}
}
/// Wrapping OpenCV IplImage Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct IplImage
{
public int nSize; /* sizeof(IplImage) */
public int ID; /* version (=0)*/
public int nChannels; /* Most of OpenCV functions support 1,2,3 or 4 channels */
private int alphaChannel; /* ignored by OpenCV */
public int depth; /* pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16U, IPL_DEPTH_16S, IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
private byte[] colorModel; /* ignored by OpenCV */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
private byte[] channelSeq; /* ignored by OpenCV */
public int dataOrder; /* 0 - interleaved color channels, 1 - separate color channels. cvCreateImage can only create interleaved images */
public int origin; /* 0 - top-left origin, 1 - bottom-left origin (Windows bitmaps style) */
public int align; /* Alignment of image rows (4 or 8). OpenCV ignores it and uses widthStep instead */
public int width; /* image width in pixels */
public int height; /* image height in pixels */
public IntPtr roi; /* image ROI. when it is not NULL, this specifies image region to process */
private IntPtr maskROI; /* must be NULL in OpenCV */
private IntPtr imageId; /* must be NULL in OpenCV */
private IntPtr tileInfo; /* must be NULL in OpenCV */
public int imageSize; /* image data size in bytes (=image->height*image->widthStep in case of interleaved data) */
public IntPtr imageData; /* pointer to aligned image data */
public int widthStep; /* size of aligned image row in bytes */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
private int[] BorderMode; /* ignored by OpenCV */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
private int[] BorderConst; /* ignored by OpenCV */
public IntPtr imageDataOrigin; /* pointer to a very origin of image data (not necessarily aligned) - it is needed for correct image deallocation */
}
/// Wrapping OpenCV CvMemStorage Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvMemStorage
{
public IntPtr bottom; /* first allocated block */
public IntPtr top; /* current memory block - top of the stack */
public IntPtr parent; /* borrows new blocks from */
public int block_size; /* block size */
public int free_space; /* free space in the current block */
}
/// Wrapping OpenCV CvMemBlock Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvMemBlock
{
public IntPtr prev;
public IntPtr next;
}
/// Wrapping OpenCV CvMemStoragePos Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvMemStoragePos
{
public IntPtr top;
public int free_space;
}
/// Wrapping OpenCV CvString Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvString
{
public int len;
public IntPtr ptr;
}
/// Wrapping OpenCV CvStringHashNode Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvStringHashNode
{
public uint hashval;
public CvString str;
public IntPtr next;
}
/// Wrapping OpenCV CvAttrList Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvAttrList
{
public IntPtr attr; /* NULL-terminated array of (attribute_name,attribute_value) pairs */
public IntPtr next; /* pointer to next chunk of the attributes list */
}
/// Wrapping OpenCV CvSeq Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvSeq
{
public int flags; /* micsellaneous flags */
public int header_size; /* size of sequence header */
public IntPtr h_prev; /* previous sequence */
public IntPtr h_next; /* next sequence */
public IntPtr v_prev; /* 2nd previous sequence */
public IntPtr v_next; /* 2nd next sequence */
public int total; /* total number of elements */
public int elem_size; /* size of sequence element in bytes */
public IntPtr block_max; /* maximal bound of the last block */
public IntPtr ptr; /* current write pointer */
public int delta_elems; /* how many elements allocated when the seq grows */
public IntPtr storage; /* where the seq is stored */
public IntPtr free_blocks; /* free blocks list */
public IntPtr first; /* pointer to the first sequence block */
}
/// Wrapping OpenCV CvSeqBlock Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvSeqBlock
{
public IntPtr prev; /* previous sequence block */
public IntPtr next; /* next sequence block */
public int start_index; /* index of the first element in the block + sequence->first->start_index */
public int count; /* number of elements in the block */
public IntPtr data; /* pointer to the first element of the block */
}
/// Wrapping OpenCV CvSlice Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvSlice
{
public int start_index;
public int end_index;
public CvSlice(int start_index, int end_index)
{
this.start_index = start_index;
this.end_index = end_index;
}
}
/// Wrapping OpenCV CvSetElem Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvSetElem
{
public int flags; /* it is negative if the node is free and zero or positive otherwise */
public IntPtr next_free; /* if the node is free, the field is a pointer to next free node */
}
/// Wrapping OpenCV CvSet Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvSet
{
public int flags; /* micsellaneous flags */
public int header_size; /* size of sequence header */
public IntPtr h_prev; /* previous sequence */
public IntPtr h_next; /* next sequence */
public IntPtr v_prev; /* 2nd previous sequence */
public IntPtr v_next; /* 2nd next sequence */
public int total; /* total number of elements */
public int elem_size; /* size of sequence element in bytes */
public IntPtr block_max; /* maximal bound of the last block */
public IntPtr ptr; /* current write pointer */
public int delta_elems; /* how many elements allocated when the seq grows */
public IntPtr storage; /* where the seq is stored */
public IntPtr free_blocks; /* free blocks list */
public IntPtr first; /* pointer to the first sequence block */
public IntPtr free_elems; /* list of free nodes */
}
/// Wrapping OpenCV CvGraphVtx Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvGraphVtx
{
public int flags; /* vertex flags */
public IntPtr first; /* the first incident edge */
}
/// Wrapping OpenCV CvGraphEdge Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvGraphEdge
{
public int flags; /* edge flags */
public float weight; /* edge weight */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public IntPtr[] next; /* the next edges in the incidence lists for staring (0) and ending (1) vertices */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public IntPtr[] vtx; /* the starting (0) and ending (1) vertices */
public CvGraphEdge(int foo)
{
this.flags = foo;
this.weight = foo;
this.next = new IntPtr[2];
this.vtx = new IntPtr[2];
}
}
/// Wrapping OpenCV CvGraph Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvGraph
{
public int flags; /* micsellaneous flags */
public int header_size; /* size of sequence header */
public IntPtr h_prev; /* previous sequence */
public IntPtr h_next; /* next sequence */
public IntPtr v_prev; /* 2nd previous sequence */
public IntPtr v_next; /* 2nd next sequence */
public int total; /* total number of elements */
public int elem_size; /* size of sequence element in bytes */
public IntPtr block_max; /* maximal bound of the last block */
public IntPtr ptr; /* current write pointer */
public int delta_elems; /* how many elements allocated when the seq grows */
public IntPtr storage; /* where the seq is stored */
public IntPtr free_blocks; /* free blocks list */
public IntPtr first; /* pointer to the first sequence block */
public IntPtr free_elems; /* list of free nodes */
public IntPtr edges; /* set of edges */
}
/// Wrapping OpenCV cvGraphFindEdge Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct cvGraphFindEdge { }
/// Wrapping OpenCV CvGraphScanner Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvGraphScanner
{
public IntPtr vtx; /* current graph vertex (or current edge origin) */
public IntPtr dst; /* current graph edge destination vertex */
public IntPtr edge; /* current edge */
public IntPtr graph; /* the graph */
public IntPtr stack; /* the graph vertex stack */
public int index; /* the lower bound of certainly visited vertices */
public int mask; /* event mask */
}
/// Wrapping OpenCV CvTreeNodeIterator Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvTreeNodeIterator
{
public IntPtr node;
public int level;
public int max_level;
}
/// Wrapping OpenCV CvFont Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvFont
{
public int font_face; /* =CV_FONT_* */
public IntPtr ascii; /* font data and metrics */
public IntPtr greek;
public IntPtr cyrillic;
public float hscale;
public float vscale;
public float shear; /* slope coefficient: 0 - normal, >0 - italic */
public int thickness; /* letters thickness */
public float dx; /* horizontal interval between letters */
public int line_type;
}
/// Wrapping OpenCV CvFileStorage Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvFileStorage { }
/// Wrapping OpenCV CvTypeInfo Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvTypeInfo
{
int flags; /* not used */
int header_size; /* sizeof(CvTypeInfo) */
IntPtr prev; /* previous registered type in the list */
IntPtr next; /* next registered type in the list */
string type_name; /* type name, written to file storage */
/* methods */
[MarshalAs(UnmanagedType.FunctionPtr)]
CvIsInstanceFunc is_instance; /* checks if the passed object belongs to the type */
[MarshalAs(UnmanagedType.FunctionPtr)]
CvReleaseFunc release; /* releases object (memory etc.) */
[MarshalAs(UnmanagedType.FunctionPtr)]
CvReadFunc read; /* reads object from file storage */
[MarshalAs(UnmanagedType.FunctionPtr)]
CvWriteFunc write; /* writes object to file storage */
[MarshalAs(UnmanagedType.FunctionPtr)]
CvCloneFunc clone; /* creates a copy of the object */
}
/// Wrapping OpenCV CvPluginFuncInfo Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvPluginFuncInfo
{
public IntPtr func_addr;
public IntPtr default_func_addr;
public string func_names;
public int search_modules;
public int loaded_from;
}
/// Wrapping OpenCV CvModuleInfo Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvModuleInfo
{
public IntPtr next;
public string name;
public string version;
public IntPtr func_tab;
}
/// Wrapping OpenCV IplConvKernel Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct IplConvKernel
{
public int nCols;
public int nRows;
public int anchorX;
public int anchorY;
public IntPtr values;
public int nShiftR;
public IplConvKernel(int a_nCols, int a_nRows, int a_anchorX, int a_anchorY, IntPtr a_values, int a_nShiftR)
{
this.nCols = a_nCols;
this.nRows = a_nRows;
this.anchorX = a_anchorX;
this.anchorY = a_anchorY;
this.values = a_values;
this.nShiftR = a_nShiftR;
}
}
/// Wrapping OpenCV CvContourScanner Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvContourScanner { }
/// Wrapping OpenCV CvConnectedComp Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvConnectedComp
{
public double area; /* area of the segmented component */
public float value; /* gray scale value of the segmented component */
public CvRect rect; /* ROI of the segmented component */
}
/// Wrapping OpenCV CvMoments Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvMoments
{
public double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */
public double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /* central moments */
public double inv_sqrt_m00; /* m00 != 0 ? 1/sqrt(m00) : 0 */
}
/// Wrapping OpenCV CvHuMoments Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvHuMoments
{
public double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /* Hu invariants */
}
/// Wrapping OpenCV CvHistogram Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvHistogram
{
public int type;
public IntPtr bins;
public IntPtr thresh; /* for uniform histograms */
public IntPtr thresh2; /* for non-uniform histograms */
public CvMatND mat; /* embedded matrix header for array histograms */
public CvHistogram(int foo)
{
this.type = foo;
this.bins = IntPtr.Zero;
this.thresh = IntPtr.Zero;
this.thresh2 = IntPtr.Zero;
this.mat = new CvMatND();
}
}
/// Wrapping OpenCV CvChain Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvChain
{
public int flags; /* micsellaneous flags */
public int header_size; /* size of sequence header */
public IntPtr h_prev; /* previous sequence */
public IntPtr h_next; /* next sequence */
public IntPtr v_prev; /* 2nd previous sequence */
public IntPtr v_next; /* 2nd next sequence */
public int total; /* total number of elements */
public int elem_size; /* size of sequence element in bytes */
public IntPtr block_max; /* maximal bound of the last block */
public IntPtr ptr; /* current write pointer */
public int delta_elems; /* how many elements allocated when the seq grows */
public IntPtr storage; /* where the seq is stored */
public IntPtr free_blocks; /* free blocks list */
public IntPtr first; /* pointer to the first sequence block */
public CvPoint origin;
}
/// Wrapping OpenCV CvChainPtReader Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvChainPtReader
{
public int header_size;
public IntPtr seq; /* sequence, beign read */
public IntPtr block; /* current block */
public IntPtr ptr; /* pointer to element be read next */
public IntPtr block_min; /* pointer to the beginning of block */
public IntPtr block_max; /* pointer to the end of block */
public int delta_index; /* = seq->first->start_index */
public IntPtr prev_elem; /* pointer to previous element */
public char code;
public CvPoint pt;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public byte[][] deltas;
public CvChainPtReader(int foo)
{
this.header_size = foo;
this.seq = IntPtr.Zero;
this.block = IntPtr.Zero;
this.ptr = IntPtr.Zero;
this.block_min = IntPtr.Zero;
this.block_max = IntPtr.Zero;
this.delta_index = foo;
this.prev_elem = IntPtr.Zero;
this.code = (char)foo;
this.pt = new CvPoint(foo, foo);
this.deltas = new byte[8][];
for (int i = 0; i < 8; i++)
this.deltas[i] = new byte[2];
}
}
/// Wrapping OpenCV CvContourTree Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvContourTree
{
public int flags; /* micsellaneous flags */
public int header_size; /* size of sequence header */
public IntPtr h_prev; /* previous sequence */
public IntPtr h_next; /* next sequence */
public IntPtr v_prev; /* 2nd previous sequence */
public IntPtr v_next; /* 2nd next sequence */
public int total; /* total number of elements */
public int elem_size; /* size of sequence element in bytes */
public IntPtr block_max; /* maximal bound of the last block */
public IntPtr ptr; /* current write pointer */
public int delta_elems; /* how many elements allocated when the seq grows */
public IntPtr storage; /* where the seq is stored */
public IntPtr free_blocks; /* free blocks list */
public IntPtr first; /* pointer to the first sequence block */
public CvPoint p1; /* the first point of the binary tree root segment */
public CvPoint p2; /* the last point of the binary tree root segment */
}
/// Wrapping OpenCV CvContour Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvContour
{
public int flags; /* micsellaneous flags */
public int header_size; /* size of sequence header */
public IntPtr h_prev; /* previous sequence */
public IntPtr h_next; /* next sequence */
public IntPtr v_prev; /* 2nd previous sequence */
public IntPtr v_next; /* 2nd next sequence */
public int total; /* total number of elements */
public int elem_size; /* size of sequence element in bytes */
public IntPtr block_max; /* maximal bound of the last block */
public IntPtr ptr; /* current write pointer */
public int delta_elems; /* how many elements allocated when the seq grows */
public IntPtr storage; /* where the seq is stored */
public IntPtr free_blocks; /* free blocks list */
public IntPtr first; /* pointer to the first sequence block */
public CvRect rect;
public int color;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public int[] reserved;
public CvContour(int foo)
{
this.flags = foo;
this.header_size = foo;
this.h_prev = IntPtr.Zero;
this.h_next = IntPtr.Zero;
this.v_prev = IntPtr.Zero;
this.v_next = IntPtr.Zero;
this.total = foo;
this.elem_size = foo;
this.block_max = IntPtr.Zero;
this.ptr = IntPtr.Zero;
this.delta_elems = foo;
this.storage = IntPtr.Zero;
this.free_blocks = IntPtr.Zero;
this.first = IntPtr.Zero;
this.rect = new CvRect(foo);
this.color = foo;
this.reserved = new int[3];
}
}
/// Wrapping OpenCV CvConvexityDefect Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvConvexityDefect
{
public IntPtr start; /* point of the contour where the defect begins */
public IntPtr end; /* point of the contour where the defect ends */
public IntPtr depth_point; /* the farthest from the convex hull point within the defect */
public float depth; /* distance between the farthest point and the convex hull */
}
/// Wrapping OpenCV CvSubdiv2D Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvSubdiv2D
{
public int quad_edges;
public int is_geometry_valid;
public long recent_edge;
public CvPoint2D32f topleft;
public CvPoint2D32f bottomright;
}
/// Wrapping OpenCV CvQuadEdge2D Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvQuadEdge2D
{
public int flags;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public IntPtr[] pt;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public long[] next;
public CvQuadEdge2D(int foo)
{
this.flags = foo;
this.pt = new IntPtr[4];
this.next = new long[4];
}
}
/// Wrapping OpenCV CvSubdiv2DPoint Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvSubdiv2DPoint
{
public int flags;
public long first;
public CvPoint2D32f pt;
}
/// Wrapping OpenCV CvKalman Structure
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct CvKalman
{
public int MP; /* number of measurement vector dimensions */
public int DP; /* number of state vector dimensions */
public int CP; /* number of control vector dimensions */
public IntPtr PosterState; /* =state_pre->data.fl */
public IntPtr PriorState; /* =state_post->data.fl */
public IntPtr DynamMatr; /* =transition_matrix->data.fl */
public IntPtr MeasurementMatr; /* =measurement_matrix->data.fl */
public IntPtr MNCovariance; /* =measurement_noise_cov->data.fl */
public IntPtr PNCovariance; /* =process_noise_cov->data.fl */
public IntPtr KalmGainMatr; /* =gain->data.fl */
public IntPtr PriorErrorCovariance; /* =error_cov_pre->data.fl */
public IntPtr PosterErrorCovariance; /* =error_cov_post->d*/
}
}
}