Emgu-WPF学习使用 - 颜色映射
Posted lonelyxmas
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Emgu-WPF学习使用 - 颜色映射相关的知识,希望对你有一定的参考价值。
原文: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学习使用 - 颜色映射的主要内容,如果未能解决你的问题,请参考以下文章