当前位置: 首页 > news >正文

广州做外贸网站建设c 教程如何做网站

广州做外贸网站建设,c 教程如何做网站,做响应网站,网站空间哪家好直方图 直方图均衡化 自适应的直方图均衡化 全局直方图均衡化 局部直方图均衡化 对比度调整 代码 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using Sy…直方图 直方图均衡化 自适应的直方图均衡化 全局直方图均衡化 局部直方图均衡化 对比度调整 代码 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using OpenCvSharp;namespace OpenCvSharp_图像去雾 {public partial class Form1 : Form{public Form1(){InitializeComponent();}string fileFilter *.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png;string imgPath ;private void button1_Click(object sender, EventArgs e){OpenFileDialog ofd new OpenFileDialog();ofd.Filter fileFilter;if (ofd.ShowDialog() ! DialogResult.OK) return;pictureBox1.Image null;imgPath ofd.FileName;pictureBox1.Image new Bitmap(imgPath);}/// summary/// 直方图均衡化/// /summary/// param namesender/param/// param namee/paramprivate void button2_Click(object sender, EventArgs e){if (imgPath ) return;Mat mat Cv2.ImRead(imgPath, ImreadModes.Grayscale);Cv2.EqualizeHist(mat, mat);pictureBox2.Image OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);}/// summary/// 自适应的直方图均衡化/// 将整幅图像分成很多小块然后再对每一个小块分别进行直方图均衡化最后进行拼接/// /summary/// param namesender/param/// param namee/paramprivate void button3_Click(object sender, EventArgs e){if (imgPath ) return;Mat mat Cv2.ImRead(imgPath, ImreadModes.Grayscale);CLAHE clahe Cv2.CreateCLAHE(10.0, new OpenCvSharp.Size(8, 8));clahe.Apply(mat, mat);pictureBox2.Image OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);}/// summary/// 全局直方图处理/// 全局直方图处理通过对 RGB 图像的 R、G、B 三层通道分别进行直方图均衡化再整合到新的图像的方式进行。/// /summary/// param namesender/param/// param namee/paramprivate void button4_Click(object sender, EventArgs e){if (imgPath ) return;Mat mat Cv2.ImRead(imgPath);Mat[] mats Cv2.Split(mat);//拆分//Mat mats0 mats[0];//B//Mat mats1 mats[1];//G//Mat mats2 mats[2];//RCv2.EqualizeHist(mats[0], mats[0]);Cv2.EqualizeHist(mats[1], mats[1]);Cv2.EqualizeHist(mats[2], mats[2]);Cv2.Merge(new Mat[] { mats[0], mats[1], mats[2] }, mat);pictureBox2.Image OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);}/// summary/// 局部直方图处理/// 即自适应直方图均衡化/// /summary/// param namesender/param/// param namee/paramprivate void button5_Click(object sender, EventArgs e){if (imgPath ) return;CLAHE clahe Cv2.CreateCLAHE(6.0, new OpenCvSharp.Size(8, 8));Mat mat Cv2.ImRead(imgPath);Mat[] mats Cv2.Split(mat);//拆分clahe.Apply(mats[0], mats[0]);//Bclahe.Apply(mats[1], mats[1]);//Gclahe.Apply(mats[2], mats[2]);//RCv2.Merge(new Mat[] { mats[0], mats[1], mats[2] }, mat);pictureBox2.Image OpenCvSharp.Extensions.BitmapConverter.ToBitmap(mat);}/// summary/// 直方图/// /summary/// param namesender/param/// param namee/paramprivate void button6_Click(object sender, EventArgs e){if (imgPath ) return;Mat lena Cv2.ImRead(imgPath);Mat[] mats Cv2.Split(lena);//一张图片将lena拆分成3个图片装进matMat[] mats0 new Mat[] { mats[0] };//BMat[] mats1 new Mat[] { mats[1] };//GMat[] mats2 new Mat[] { mats[2] };//RMat[] hist new Mat[] { new Mat(), new Mat(), new Mat() };//一个矩阵数组用来接收直方图,记得全部初始化int[] channels new int[] { 0 };//一个通道,初始化为通道0int[] histsize new int[] { 256 };//初始化为256箱子Rangef[] range new Rangef[1];//一个通道范围range[0] new Rangef(0, 256);//从0开始含,到256结束不含Mat mask new Mat();//不做掩码Cv2.CalcHist(mats0, channels, mask, hist[0], 1, histsize, range);//对被拆分的图片单独进行计算Cv2.CalcHist(mats1, channels, mask, hist[1], 1, histsize, range);//对被拆分的图片单独进行计算Cv2.CalcHist(mats2, channels, mask, hist[2], 1, histsize, range);//对被拆分的图片单独进行计算Cv2.Normalize(hist[0], hist[0], 0, 256, NormTypes.MinMax);// 归一化Cv2.Normalize(hist[1], hist[1], 0, 256, NormTypes.MinMax);// 归一化Cv2.Normalize(hist[2], hist[2], 0, 256, NormTypes.MinMax);// 归一化double minVal0, maxVal0;Cv2.MinMaxLoc(hist[0], out minVal0, out maxVal0);double minVal1, maxVal1;Cv2.MinMaxLoc(hist[1], out minVal1, out maxVal1);double minVal2, maxVal2;Cv2.MinMaxLoc(hist[2], out minVal2, out maxVal2);double minVal Math.Min(minVal0, Math.Min(minVal1, minVal2));double maxVal Math.Max(maxVal0, Math.Max(maxVal1, maxVal2));int height 512;int width 512;hist[0] hist[0] * (maxVal ! 0 ? height / maxVal : 0.0);hist[1] hist[1] * (maxVal ! 0 ? height / maxVal : 0.0);hist[2] hist[2] * (maxVal ! 0 ? height / maxVal : 0.0);Mat histImage new Mat(height, width, MatType.CV_8UC3, new Scalar(100, 100, 100));int binW (int)((double)width / histsize[0]);for (int i 0; i histsize[0]; i){histImage.Rectangle(new OpenCvSharp.Point(i * binW, histImage.Rows - (int)hist[0].Getfloat(i)),new OpenCvSharp.Point((i 1) * binW, histImage.Rows),new Scalar(255, 0, 0),-1);histImage.Rectangle(new OpenCvSharp.Point(i * binW, histImage.Rows - (int)hist[1].Getfloat(i)),new OpenCvSharp.Point((i 1) * binW, histImage.Rows),new Scalar(0, 255, 0),-1);histImage.Rectangle(new OpenCvSharp.Point(i * binW, histImage.Rows - (int)hist[2].Getfloat(i)),new OpenCvSharp.Point((i 1) * binW, histImage.Rows),new Scalar(0, 0, 255),-1);}pictureBox2.Image OpenCvSharp.Extensions.BitmapConverter.ToBitmap(histImage);//Cv2.ImShow(hist, histImage);}/// summary/// 画面对比度调整/// 此处需要注意的是采用了YCrCB格式该格式的Y通道是亮度对其调整实际上调整的是对比度不会导致图片本身的失真。/// /summary/// param namesender/param/// param namee/paramprivate void button7_Click(object sender, EventArgs e){if (imgPath ) return;Mat lena Cv2.ImRead(imgPath, ImreadModes.Color);Mat yCbCR new Mat();Cv2.CvtColor(lena, yCbCR, ColorConversionCodes.BGR2YCrCb);Mat[] channels Cv2.Split(yCbCR);//一张图片将lena拆分成3个图片装进matCv2.EqualizeHist(channels[0], channels[0]);Cv2.Merge(channels, yCbCR);Mat result new Mat();Cv2.CvtColor(yCbCR, result, ColorConversionCodes.YCrCb2BGR);pictureBox2.Image OpenCvSharp.Extensions.BitmapConverter.ToBitmap(result);//Cv2.ImShow(origin, lena);//Cv2.ImShow(EqualizeHist, result);}} }Demo下载
http://www.pierceye.com/news/572174/

相关文章:

  • 网站优化方式重庆建设网站哪家专业
  • php做网站基本流程旅游网站论文
  • 网站前期准备网页制作需要学多久
  • 广园路建设公司网站建app网站要多少钱
  • 网站域名是什么东西wordpress农历插件
  • 专业网站建设公司首选公司wordpress fruitful
  • 微博wap版登录入口seo 网站标题长度
  • 网站面包屑导航设计即位置导航局域网安装wordpress
  • 泰安网站建设xtempire国家开放大学网站界面设计
  • 绘制网站结构图建站公司售后服务
  • 漂亮的博客网站模板装修公司网站开发
  • 厦门网站注册与网页设计公司wordpress找不到php的拓展
  • 常熟网站建设icp备案自己怎样创建网站
  • 移动互联网站建设seo流量排名门户
  • 做腰椎核磁证网站是 收 七设计网络品牌营销方案思路
  • 外贸网站建站系统基于php网站开发
  • 可以做代销的网站都有哪些神马网站快速排名案例
  • 个人能申请网站吗百度站长提交网址
  • 给素材网站做签约设计不想做了网络规划设计师教程第2版pdf
  • 新做的网站怎样推广html代码加密
  • 织梦淘宝客网站嘉兴网站开发公司
  • 宁波网站推广营销网上购物软件哪个好
  • 网站 风格做网站都可以做什么
  • 网站的建设公司简介现在建站好么
  • 简述电子商务网站建设流程wordpress极速优化
  • 移动网站怎么做万维设计
  • 建设网站我们重中之重-用户体验企业网站模板 首页大图
  • 怎么在本地做网站wordpress 建表
  • wordpress整站数据网站设计公司排名
  • 常州建设局网站海南网站建设报价方案