利用OpenCV的.Net下的EmguCV白平衡技术进行图像修复

利用OpenCV 的白平衡技术,进行图像修复。

新建项目Test,并引用EmguCV,选择项目右键管理NuGet程序包,输入EmguCV,点击安装,即可,下面添加一个方法

/// <summary>
        /// 利用OpenCV的EmguCVXPhotoWhiteBalancer白平衡技术,进行图像修复
        /// </summary>
        public static void TestEmguCVXPhotoWhiteBalancer()
        {
            Console.WriteLine($"---利用OpenCV的白平衡技术,进行图像修复---");
            //Mat mat = CvInvoke.Imread("123.jpg"/*, ImreadModes.Color*/);//读取图像文件
            Mat mat = CvInvoke.Imread(@"C:\Users\Administrator\Desktop\1234.png", LoadImageType.Color);//读取图像文件
            Emgu.CV.XPhoto.XPhotoInvoke.BalanceWhite(mat, mat,WhiteBalanceMethod.Simple);//白平衡处理
            //Emgu.CV.XPhoto.WhiteBalancer gwb = new Emgu.CV.XPhoto.SimpleWB();//实例化对象
            //gwb.BalanceWhite(mat, mat);//白平衡处理
            Bitmap bmp = mat.Bitmap;//处理的结果
            bmp.Save(@"C:\Users\Administrator\Desktop\1234WhiteBalancer.jpg");//保存
            Console.WriteLine($"---利用OpenCV的白平衡技术,进行图像修复---修复完成");
        }

 

主程序代码如下,运行

     static void Main(string[] args)
        {
            TestEmguCVXPhotoWhiteBalancer();
            Console.Read();
        }

 

上一篇:opencv-cvRound返回整数值-四舍五入


下一篇:圆形标定板标定的opencv c++实现