C#中 Mat的矩阵数据转化为Matrix类型
Mat mask = new Mat(rows, cols, DepthType.Cv8U, 1);
Matrix<Byte> xx = new Matrix<Byte>(mask.Rows, mask.Cols);
mask.CopyTo(xx);
CountHowManyPairsExist(xx);
Matrix converted to Mat
Bitmap bitmap; //This is your bitmap
Image<Bgr, Byte> imageCV = new Image<Bgr, byte>(bitmap); //Image Class from Emgu.CV
Mat mat = imageCV.Mat; //This is your Image converted to Mat