1、图片拆分通道图层
/// <summary>
/// 图片拆分通道图层
/// </summary>
/// <param name="mat">图片</param>
/// <returns></returns>
public static Mat[] SplitChannel(Mat mat)
{
// 拆分通道
Cv2.Split(mat, out Mat[] mats);
return mats;
}
2、图片合并通道图层
/// <summary>
/// 图片合并通道图层
/// 注:合并通道的顺序不用,显示效果不同;
/// 按照BGR拆分的则按照BGR合并
/// </summary>
/// <param name="mats">图片集</param>
/// <returns></returns>
public static Mat MergeChannel(Mat[] mats)
{
Mat mat = new Mat();
// 合并通道
Cv2.Merge(mats, mat);
mat.ConvertTo(mat, MatType.CV_8U);
return mat;
}
标签:Mat,C#,mats,OpenCV,拆分,图层,通道,mat
From: https://www.cnblogs.com/qq2806933146xiaobai/p/18294487