码迷,mamicode.com
首页 > Windows程序 > 详细

Emgu-WPF学习使用 - 颜色映射

时间:2018-08-14 11:38:37      阅读:308      评论:0      收藏:0      [点我收藏+]

标签:rhs   pat   string   led   draw   lang   rom   type   origin   

原文:Emgu-WPF学习使用 - 颜色映射

技术分享图片

            string sFile = "";
            if (!String.IsNullOrEmpty(AppConstUtils.GDefaultFile) && File.Exists(AppConstUtils.GDefaultFile))
                sFile = AppConstUtils.GDefaultFile;
            else
                sFile = GlobalVar.DATAS_PATH + "Samples/Test5.jpg";

            System.Drawing.Image imgOrigin = System.Drawing.Image.FromFile(sFile);
            Bitmap barcodeBitmap = new Bitmap(imgOrigin);
            Image<Bgr, byte> imgSrc = new Image<Bgr, byte>(barcodeBitmap);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgSrc, "原始图");
            imgOrigin.Dispose();
            barcodeBitmap.Dispose();

            Image<Gray, byte> imgGray = new Image<Gray, byte>(imgSrc.Size);
            CvInvoke.CvtColor(imgSrc, imgGray, ColorConversion.Bgr2Gray);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgGray, "灰度化->");

            Image<Bgr, byte> imgColorAutumn = new Image<Bgr, byte>(imgSrc.Size);
            CvInvoke.ApplyColorMap(imgGray, imgColorAutumn, ColorMapType.Autumn);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgColorAutumn, "灰度化->Autumn颜色映射");

            Image<Bgr, byte> imgColorBone = new Image<Bgr, byte>(imgSrc.Size);
            CvInvoke.ApplyColorMap(imgGray, imgColorBone, ColorMapType.Bone);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgColorBone, "灰度化->Bone颜色映射");

            Image<Bgr, byte> imgColorCool = new Image<Bgr, byte>(imgSrc.Size);
            CvInvoke.ApplyColorMap(imgGray, imgColorCool, ColorMapType.Cool);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgColorCool, "灰度化->Cool颜色映射");

            Image<Bgr, byte> imgColorHot = new Image<Bgr, byte>(imgSrc.Size);
            CvInvoke.ApplyColorMap(imgGray, imgColorHot, ColorMapType.Hot);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgColorHot, "灰度化->Hot颜色映射");

            Image<Bgr, byte> imgColorHsv = new Image<Bgr, byte>(imgSrc.Size);
            CvInvoke.ApplyColorMap(imgGray, imgColorHsv, ColorMapType.Hsv);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgColorHsv, "灰度化->Hsv颜色映射");

            Image<Bgr, byte> imgColorJet = new Image<Bgr, byte>(imgSrc.Size);
            CvInvoke.ApplyColorMap(imgGray, imgColorJet, ColorMapType.Jet);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgColorJet, "灰度化->Jet颜色映射");

            Image<Bgr, byte> imgColorOcean = new Image<Bgr, byte>(imgSrc.Size);
            CvInvoke.ApplyColorMap(imgGray, imgColorOcean, ColorMapType.Ocean);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgColorOcean, "灰度化->Ocean颜色映射");

            Image<Bgr, byte> imgColorPink = new Image<Bgr, byte>(imgSrc.Size);
            CvInvoke.ApplyColorMap(imgGray, imgColorPink, ColorMapType.Pink);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgColorPink, "灰度化->Pink颜色映射");

            Image<Bgr, byte> imgColorRainbow = new Image<Bgr, byte>(imgSrc.Size);
            CvInvoke.ApplyColorMap(imgGray, imgColorRainbow, ColorMapType.Rainbow);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgColorRainbow, "灰度化->Rainbow颜色映射");

            Image<Bgr, byte> imgColorSpring = new Image<Bgr, byte>(imgSrc.Size);
            CvInvoke.ApplyColorMap(imgGray, imgColorSpring, ColorMapType.Spring);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgColorSpring, "灰度化->Spring颜色映射");

            Image<Bgr, byte> imgColorSummer = new Image<Bgr, byte>(imgSrc.Size);
            CvInvoke.ApplyColorMap(imgGray, imgColorSummer, ColorMapType.Summer);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgColorSummer, "灰度化->Summer颜色映射");

            Image<Bgr, byte> imgColorWinter = new Image<Bgr, byte>(imgSrc.Size);
            CvInvoke.ApplyColorMap(imgGray, imgColorWinter, ColorMapType.Winter);
            AppUtils.AttachImageItem(this.WpDemo1Zm, imgColorWinter, "灰度化->Winter颜色映射");

Emgu-WPF学习使用 - 颜色映射

标签:rhs   pat   string   led   draw   lang   rom   type   origin   

原文地址:https://www.cnblogs.com/lonelyxmas/p/9472688.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!