C#+OpenCV实战(二)_春天转秋天

/// <summary>
/// 春天转化为秋天
/// </summary>
/// <param name="mat">图片</param>
/// <returns>结果图片</returns>
public static Mat Cvt_Spring2Autumn(Mat mat)
{
    Mat dstMat = new Mat();
    Cv2.CvtColor(mat, dstMat, ColorConversionCodes.BGR2Lab);

    Mat[] mats = Cv2.Split(dstMat);
    mats[1] = mats[1] * 0 + 127;
    Cv2.Merge(mats, dstMat);

    Cv2.CvtColor(dstMat, dstMat, ColorConversionCodes.Lab2BGR);
    return dstMat;
}
posted @ 2024-07-11 11:45  ꧁执笔小白꧂  阅读(39)  评论(0编辑  收藏  举报