此文转至:http://www.cnblogs.com/bomo/archive/2013/03/28/2986573.html有改动,感谢原作者无私奉献
1、Image 类
初始化方法:Image<Bgr, Byte>
如:Image<Bgr, Byte> Image1 = Capture1.RetrieveBgrFrame();
//创建一张灰度图 Image<Gray, Byte> img1 = new Image<Gray, Byte>(480, 320); //创建一张蓝色的图片 Image<Bgr, Byte> img2 = new Image<Bgr, Byte>(480, 320, new Bgr(255, 0, 0)); //从文件创建Image Image<Bgr, Byte> img3 = new Image<Bgr, Byte>("MyImage.jpg"); //从Bitmap创建Image Bitmap bmp = new Bitmap("MyImage.jpg"); Image<Bgr, Byte> img4 = new Image<Bgr, Byte>(bmp);
参数定义如下:
TColor类型 | TDepth类型 |
Gray | Byte |
Bgr (Blue Green Red) | SByte |
Bgra (Blue Green Red Alpha) | Single (float) |
Hsv (Hue Saturation Value) | Double |
Hls (Hue Lightness Saturation) | UInt16 |
Lab (CIE L*a*b*) | Int16 |
Luv (CIE L*u*v*) | Int32 (int) |
Xyz (CIE XYZ.Rec 709 with D65 white point) | |
Ycc (YCrCb JPEG) |
2、Matrix矩阵类
与其相似
Matrix<Single> matrix = new Matrix<Single>(480, 320);
float f = matrix[100, 100];
float df = matrix.Data[100, 100];