public Emgu.CV.Mat GetMatByMat(Mat src)
{
OpenCvSharp.Mat dst = new OpenCvSharp.Mat(src.Size(), OpenCvSharp.MatType.CV_8UC3);
int height = src.Rows;
int width = src.Cols;
int cn = dst.Channels();
Emgu.CV.Image<Emgu.CV.Structure.Rgb, byte> array = new Emgu.CV.Image<Emgu.CV.Structure.Rgb, byte>(width, height, new Emgu.CV.Structure.Rgb(0, 0, 0));
array.SetZero();
int R = 1;
for (int row = 0; row < height; row++)
{
for (int col = 0; col < width; col++)
{
int value = src.At<Vec3b>(row, col)[0];
array.Data[row, col, R] = (byte)value;
}
}
return array.Mat;
}