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

芷江建设局的工作人员网站加盟平台网站怎么做

芷江建设局的工作人员网站,加盟平台网站怎么做,网页制作的毕业设计论文,flash网站模板 asp1 边缘识别之Scharr算法 算法文章很多#xff0c;不再论述。 1.1 函数原型 void Cv2.Scharr(src,dst,ddepth,dx,dy,scale,delta,borderType#xff09; 1.2 参数说明 src 代表原始图像。dst 代表目标图像。ddepth 代表输出图像的深度。CV_16Sdx 代表x方向上的求导阶数… 1 边缘识别之Scharr算法 算法文章很多不再论述。 1.1  函数原型 void Cv2.Scharr(src,dst,ddepth,dx,dy,scale,delta,borderType   1.2 参数说明 src 代表原始图像。dst 代表目标图像。ddepth 代表输出图像的深度。CV_16Sdx 代表x方向上的求导阶数。dy 代表y方向上的求导阶数。scale 代表计算导数值时所采用的缩放因子默认情况下该值是1是没有缩放的。delta 代表加在目标图像dst上的值该值是可选的默认为0。borderType 代表边界样式。 2 核心代码 2.1 Scharr核心代码 public partial class CVUtility {/// summary/// Scharr 边缘检测/// /summary/// param namesrc/param/// returns/returnspublic static Mat Scharr(Mat src){// void Cv2.Scharr(src,dst,ddepth,dx,dy,scale,delta,borderType// src 代表原始图像。// dst 代表目标图像。// ddepth 代表输出图像的深度。CV_16S// dx 代表x方向上的求导阶数。// dy 代表y方向上的求导阶数。// scale 代表计算导数值时所采用的缩放因子默认情况下该值是1是没有缩放的。// delta 代表加在目标图像dst上的值该值是可选的默认为0。// borderType 代表边界样式。Mat scharrx new Mat();Cv2.Scharr(src: src,dst: scharrx,ddepth: MatType.CV_64F,xorder: 1,yorder: 0,scale: 1,delta: 0,borderType: BorderTypes.Default);Mat scharry src.Scharr(MatType.CV_64F, 0, 1);Cv2.Scharr(src: src,dst: scharry,ddepth: MatType.CV_64F,xorder: 0,yorder: 1,scale: 1,delta: 0,borderType: BorderTypes.Default);Cv2.ConvertScaleAbs(scharrx, scharrx);Cv2.ConvertScaleAbs(scharry, scharry);Mat scharrxy new Mat(scharrx.Size(), scharrx.Type());Cv2.AddWeighted(src1: scharrx,alpha: 0.5,src2: scharry,beta: 0.5,gamma: 0.0,dst: scharrxy,dtype: -1);return scharrxy;} } 2.2 Scharr函数的使用 private void Scharr(object? sender, EventArgs? e) {if (txtKSize.Text.Trim().Length 1) { MessageBox.Show(KSize Required!); return; }if (!int.TryParse(txtKSize.Text.Trim(), out int ksize)) { MessageBox.Show(Invalid KSize number!); return; }if (ksize 3 || ksize 100) { MessageBox.Show(Invalid KSize number!); return; }if ((ksize % 2) ! 1) { MessageBox.Show(Odd number required for ksize!); return; }Mat src Cv2.ImRead(sourceImage);Mat dst CVUtility.Scharr(src);picResult.Image CVUtility.Mat2Bitmap(dst);PicAutosize(picResult); } 2.3 完整Form1.cs using OpenCvSharp;#pragma warning disable CS8602namespace Legal.Truffer.CVStar {public partial class Form1 : Form{string[] ImgExtentions {*.*|*.*,JPEG|*.jpg;*.jpeg,GIF|*.gif,PNG|*.png,TIF|*.tif;*.tiff,BMP|*.bmp};private int original_width { get; set; } 0;private int original_height { get; set; } 0;private string sourceImage { get; set; } ;Panel? panelTop { get; set; } null;Panel? panelBotton { get; set; } null;PictureBox? picSource { get; set; } null;PictureBox? picResult { get; set; } null;Button? btnLoad { get; set; } null;Button? btnSave { get; set; } null;Button? btnFunction { get; set; } null;Label? abKSize { get; set; } null;TextBox? txtKSize { get; set; } null;public Form1(){InitializeComponent();this.Text OPENCV C#编程入手教程 POWERED BY 深度混淆CSDN.NET;this.StartPosition FormStartPosition.CenterScreen;GUI();this.Resize FormResize;}private void FormResize(object? sender, EventArgs? e){if (this.Width 200) { this.Width 320; return; }if (this.Height 200) { this.Height 320; return; }GUI();}private void GUI(){if (panelTop null) panelTop new Panel();panelTop.Parent this;panelTop.Top 5;panelTop.Left 5;panelTop.Width this.Width - 26;panelTop.Height 85;panelTop.BorderStyle BorderStyle.FixedSingle;panelTop.BackColor Color.FromArgb(200, 200, 255);if (panelBotton null) panelBotton new Panel();panelBotton.Parent this;panelBotton.Top panelTop.Top panelTop.Height 3;panelBotton.Left 5;panelBotton.Width panelTop.Width;panelBotton.Height this.Height - panelBotton.Top - 55;panelBotton.BorderStyle BorderStyle.FixedSingle;if (picSource null) picSource new PictureBox();picSource.Parent panelBotton;picSource.Left 5;picSource.Top 5;picSource.Width (panelBotton.Width - 10) / 2;picSource.Height (panelBotton.Height - 10);picSource.BorderStyle BorderStyle.FixedSingle;if (picResult null) picResult new PictureBox();picResult.Parent panelBotton;picResult.Left picSource.Left picSource.Width 5;picResult.Top picSource.Top;picResult.Width picSource.Width;picResult.Height picSource.Height;picResult.BorderStyle BorderStyle.FixedSingle;original_width picSource.Width;original_height picSource.Height;if (btnLoad null) btnLoad new Button();btnLoad.Parent panelTop;btnLoad.Left 5;btnLoad.Top 5;btnLoad.Width 90;btnLoad.Height 38;btnLoad.Cursor Cursors.Hand;btnLoad.Text Load;btnLoad.Click Load_Image;btnLoad.BackColor Color.LightCoral;if (btnSave null) btnSave new Button();btnSave.Parent panelTop;btnSave.Left panelTop.Width - btnSave.Width - 25;btnSave.Top btnLoad.Top;btnSave.Width 90;btnSave.Height 38;btnSave.Cursor Cursors.Hand;btnSave.Text Save;btnSave.Click Save;btnSave.BackColor Color.LightCoral;if (btnFunction null) btnFunction new Button();btnFunction.Parent panelTop;btnFunction.Left btnLoad.Left btnLoad.Width 5;btnFunction.Top btnLoad.Top;btnFunction.Width 120;btnFunction.Height 38;btnFunction.Cursor Cursors.Hand;btnFunction.Text Scharr;btnFunction.Click Scharr;btnFunction.BackColor Color.LightCoral;if (abKSize null) abKSize new Label();abKSize.Parent panelTop;abKSize.Left btnFunction.Left;abKSize.Top btnFunction.Top btnFunction.Height 5;abKSize.Text KSIZE: ;if (txtKSize null) txtKSize new TextBox();txtKSize.Parent panelTop;txtKSize.Left abKSize.Left abKSize.Width 5;txtKSize.Top abKSize.Top;txtKSize.Text 3;PicAutosize(picSource);PicAutosize(picResult);}private void Load_Image(object? sender, EventArgs? e){OpenFileDialog openFileDialog new OpenFileDialog();openFileDialog.Filter String.Join(|, ImgExtentions);if (openFileDialog.ShowDialog() DialogResult.OK){sourceImage openFileDialog.FileName;picSource.Image Image.FromFile(sourceImage);picResult.Image picSource.Image;PicAutosize(picSource);PicAutosize(picResult);}}private void PicAutosize(PictureBox pb){if (pb null) return;if (pb.Image null) return;Image img pb.Image;int w original_width;int h w * img.Height / img.Width;if (h original_height){h original_height;w h * img.Width / img.Height;}pb.SizeMode PictureBoxSizeMode.Zoom;pb.Width w;pb.Height h;pb.Image img;pb.Refresh();}private void Save(object? sender, EventArgs? e){SaveFileDialog saveFileDialog new SaveFileDialog();saveFileDialog.Filter String.Join(|, ImgExtentions);if (saveFileDialog.ShowDialog() DialogResult.OK){picResult.Image.Save(saveFileDialog.FileName);MessageBox.Show(Image Save to saveFileDialog.FileName);}}private void Scharr(object? sender, EventArgs? e){if (txtKSize.Text.Trim().Length 1) { MessageBox.Show(KSize Required!); return; }if (!int.TryParse(txtKSize.Text.Trim(), out int ksize)) { MessageBox.Show(Invalid KSize number!); return; }if (ksize 3 || ksize 100) { MessageBox.Show(Invalid KSize number!); return; }if ((ksize % 2) ! 1) { MessageBox.Show(Odd number required for ksize!); return; }Mat src Cv2.ImRead(sourceImage);Mat dst CVUtility.Scharr(src);picResult.Image CVUtility.Mat2Bitmap(dst);PicAutosize(picResult);}} }3 运行效果 实际上一般都用黑白照片。
http://www.zqtcl.cn/news/889283/

相关文章:

  • 怎么制作网站导航页新手做网站详细步骤
  • 自己个人网站后台怎么做wordpress多程序用户同步
  • 赣州网联科技有限公司wordpress安装后优化
  • 二手书的网站建设做设计在哪个网站找图片大全
  • 网站seo设计北京市建设投标网站
  • 承德做网站设计的网络推广主要内容
  • 婚纱网站源代码重庆网站定制公司
  • 同一个ip网站太多 seo应用商店网站源码
  • 网站内容框架首页>新闻>正文 网站怎么做
  • 网站制作 搜索做效果图网站有哪些
  • 网站建设的相关技术网站的购物车怎么做
  • 免费建设公司网站腾讯云域名购买
  • 淘宝客网站应该怎么做网页浏览器推荐
  • 怎样做影视网站不侵权商丘专业做网站
  • 哪个网站做刷手最好鹤壁 网站建设
  • 设计接单子网站安徽网站开发推荐
  • 网站建设制作 优帮云怎样注册商标申请
  • 网站怎么做交易市场苏州吴江做网站公司
  • wordpress的字体禁用优化设计的答案
  • 网站建设开发五行属性如何做二级域名网站
  • 珠海做网站的公司介绍最近的新闻大事
  • 手机网站开发解决方案石碣镇网站建设
  • 保定网站建设公司哪家好app开发公司好吗
  • 网站域名备案证书网页素材大宝库
  • 沈阳网站制作的公司哪家好wordpress您访问的网页出错
  • 南京做公司网站有什么网站用名字做图片大全
  • 网站正在建设中页面wordpress 折叠文章
  • 广西建设科技协会网站手工做环保衣的网站
  • 怎么免费做网站教程开发专业网站
  • 鹿邑网站设计公司什么网站可以免费做找客户