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

动画网站模块珠海市做网站

动画网站模块,珠海市做网站,光明随心订网站怎么做,为什么最近好多网站维护划痕检测,我这里用到的是Sobel算子和blob斑点匹配以及blob里面的形态学调整 Sobel 是一种在数字图像处理和计算机视觉领域广泛应用的算法#xff0c;主要用于边缘检测 脚本展示 #region namespace imports using System; using System.Collections; using System.Drawing; … 划痕检测,我这里用到的是Sobel算子和blob斑点匹配以及blob里面的形态学调整 Sobel 是一种在数字图像处理和计算机视觉领域广泛应用的算法主要用于边缘检测 脚本展示  #region namespace imports using System; using System.Collections; using System.Drawing; using System.IO; using System.Windows.Forms; using Cognex.VisionPro; using Cognex.VisionPro.ToolBlock; using Cognex.VisionPro3D; using Cognex.VisionPro.ImageProcessing; using Cognex.VisionPro.Blob; #endregionpublic class CogToolBlockAdvancedScript : CogToolBlockAdvancedScriptBase {#region Private Member Variablesprivate Cognex.VisionPro.ToolBlock.CogToolBlock mToolBlock;#endregionCogGraphicCollection dt new CogGraphicCollection();/// summary/// Called when the parent tool is run./// Add code here to customize or replace the normal run behavior./// /summary/// param namemessageSets the Message in the tools RunStatus./param/// param nameresultSets the Result in the tools RunStatus/param/// returnsTrue if the tool should run normally,/// False if GroupRun customizes run behavior/returnspublic override bool GroupRun(ref string message, ref CogToolResultConstants result){// To let the execution stop in this script when a debugger is attached, uncomment the following lines.// #if DEBUG// if (System.Diagnostics.Debugger.IsAttached) System.Diagnostics.Debugger.Break();// #endifCogBlobTool blob mToolBlock.Tools[CogBlobTool1]as CogBlobTool;// Run each tool using the RunTool functionforeach(ICogTool tool in mToolBlock.Tools)mToolBlock.RunTool(tool, ref message, ref result);for(int i 0;i blob.Results.GetBlobs().Count;i){double x blob.Results.GetBlobs()[i].CenterOfMassX;double y blob.Results.GetBlobs()[i].CenterOfMassY;dt.Add(Create(x, y));}return false;}private CogRectangleAffine Create(double x, double y){CogRectangleAffine tt new CogRectangleAffine();tt.SideXLength 8;tt.SideYLength 14;tt.CenterX x;tt.CenterY y;tt.Color CogColorConstants.Red;tt.LineWidthInScreenPixels 4;return tt;}#region When the Current Run Record is Created/// summary/// Called when the current record may have changed and is being reconstructed/// /summary/// param namecurrentRecord/// The new currentRecord is available to be initialized or customized./parampublic override void ModifyCurrentRunRecord(Cognex.VisionPro.ICogRecord currentRecord){}#endregion#region When the Last Run Record is Created/// summary/// Called when the last run record may have changed and is being reconstructed/// /summary/// param namelastRecord/// The new last run record is available to be initialized or customized./parampublic override void ModifyLastRunRecord(Cognex.VisionPro.ICogRecord lastRecord){foreach(ICogGraphic s in dt){mToolBlock.AddGraphicToRunRecord(s, lastRecord, CogSobelEdgeTool1.InputImage, script);}}#endregion#region When the Script is Initialized/// summary/// Perform any initialization required by your script here/// /summary/// param namehostThe host tool/parampublic override void Initialize(Cognex.VisionPro.ToolGroup.CogToolGroup host){// DO NOT REMOVE - Call the base class implementation first - DO NOT REMOVEbase.Initialize(host);// Store a local copy of the script hostthis.mToolBlock ((Cognex.VisionPro.ToolBlock.CogToolBlock)(host));}#endregion} 效果 下面的我们先用Pixel 通过直方图调节来突出边缘和表面特征 在通过调节二值化阈值等来突出 脚本 #region namespace imports using System; using System.Collections; using System.Drawing; using System.IO; using System.Windows.Forms; using Cognex.VisionPro; using Cognex.VisionPro.ToolBlock; using Cognex.VisionPro3D; using Cognex.VisionPro.PixelMap; using Cognex.VisionPro.Blob; #endregionpublic class CogToolBlockAdvancedScript : CogToolBlockAdvancedScriptBase {#region Private Member Variablesprivate Cognex.VisionPro.ToolBlock.CogToolBlock mToolBlock;#endregionCogGraphicCollection dt new CogGraphicCollection();CogPolygon polygon;/// summary/// Called when the parent tool is run./// Add code here to customize or replace the normal run behavior./// /summary/// param namemessageSets the Message in the tools RunStatus./param/// param nameresultSets the Result in the tools RunStatus/param/// returnsTrue if the tool should run normally,/// False if GroupRun customizes run behavior/returnspublic override bool GroupRun(ref string message, ref CogToolResultConstants result){// To let the execution stop in this script when a debugger is attached, uncomment the following lines.// #if DEBUG// if (System.Diagnostics.Debugger.IsAttached) System.Diagnostics.Debugger.Break();// #endifdt.Clear();CogBlobTool blob mToolBlock.Tools[CogBlobTool1]as CogBlobTool;// Run each tool using the RunTool functionforeach(ICogTool tool in mToolBlock.Tools)mToolBlock.RunTool(tool, ref message, ref result);for(int i 0;i blob.Results.GetBlobs().Count;i){polygon new CogPolygon();polygon blob.Results.GetBlobs()[i].GetBoundary();polygon.Color CogColorConstants.Red;dt.Add(polygon);}return false;}#region When the Current Run Record is Created/// summary/// Called when the current record may have changed and is being reconstructed/// /summary/// param namecurrentRecord/// The new currentRecord is available to be initialized or customized./parampublic override void ModifyCurrentRunRecord(Cognex.VisionPro.ICogRecord currentRecord){}#endregion#region When the Last Run Record is Created/// summary/// Called when the last run record may have changed and is being reconstructed/// /summary/// param namelastRecord/// The new last run record is available to be initialized or customized./parampublic override void ModifyLastRunRecord(Cognex.VisionPro.ICogRecord lastRecord){foreach(ICogGraphic s in dt){mToolBlock.AddGraphicToRunRecord(s, lastRecord, CogPixelMapTool1.InputImage, script);}}#endregion#region When the Script is Initialized/// summary/// Perform any initialization required by your script here/// /summary/// param namehostThe host tool/parampublic override void Initialize(Cognex.VisionPro.ToolGroup.CogToolGroup host){// DO NOT REMOVE - Call the base class implementation first - DO NOT REMOVEbase.Initialize(host);// Store a local copy of the script hostthis.mToolBlock ((Cognex.VisionPro.ToolBlock.CogToolBlock)(host));}#endregion} 效果 #region namespace imports using System; using System.Collections; using System.Drawing; using System.IO; using System.Windows.Forms; using Cognex.VisionPro; using Cognex.VisionPro.ToolBlock; using Cognex.VisionPro3D; using Cognex.VisionPro.ImageProcessing; using Cognex.VisionPro.PMAlign; using Cognex.VisionPro.CalibFix; using Cognex.VisionPro.PixelMap; using Cognex.VisionPro.Blob; #endregionpublic class CogToolBlockAdvancedScript : CogToolBlockAdvancedScriptBase {#region Private Member Variablesprivate Cognex.VisionPro.ToolBlock.CogToolBlock mToolBlock;#endregionCogGraphicCollection dt new CogGraphicCollection();CogGraphicLabel label new CogGraphicLabel();/// summary/// Called when the parent tool is run./// Add code here to customize or replace the normal run behavior./// /summary/// param namemessageSets the Message in the tools RunStatus./param/// param nameresultSets the Result in the tools RunStatus/param/// returnsTrue if the tool should run normally,/// False if GroupRun customizes run behavior/returnspublic override bool GroupRun(ref string message, ref CogToolResultConstants result){// To let the execution stop in this script when a debugger is attached, uncomment the following lines.// #if DEBUG// if (System.Diagnostics.Debugger.IsAttached) System.Diagnostics.Debugger.Break();// #endifdt.Clear();CogBlobTool blob mToolBlock.Tools[CogBlobTool1]as CogBlobTool;CogPolarUnwrapTool polar mToolBlock.Tools[CogPolarUnwrapTool1]as CogPolarUnwrapTool;// Run each tool using the RunTool functionforeach(ICogTool tool in mToolBlock.Tools)mToolBlock.RunTool(tool, ref message, ref result);for(int i 0;i blob.Results.GetBlobs().Count;i){double x blob.Results.GetBlobs()[i].CenterOfMassX;double y blob.Results.GetBlobs()[i].CenterOfMassY;double lastx,lasty;polar.RunParams.GetInputPointFromOutputPoint(polar.InputImage, polar.Region, x, y, out lastx, out lasty);dt.Add(CreateCircle(lastx, lasty));}if(blob.Results.GetBlobs().Count 0){label.SetXYText(100, 100, NG);label.Alignment CogGraphicLabelAlignmentConstants.TopLeft;label.Font new Font(楷体, 20);label.Color CogColorConstants.Red;dt.Add(label);}else{label.SetXYText(100, 100, Pass);label.Alignment CogGraphicLabelAlignmentConstants.TopLeft;label.Font new Font(楷体, 20);label.Color CogColorConstants.Green;dt.Add(label);}return false;}private CogCircle CreateCircle(double x, double y){CogCircle co new CogCircle();co.CenterX x;co.CenterY y;co.Radius 30;co.Color CogColorConstants.Red;co.LineWidthInScreenPixels 6;return co;}#region When the Current Run Record is Created/// summary/// Called when the current record may have changed and is being reconstructed/// /summary/// param namecurrentRecord/// The new currentRecord is available to be initialized or customized./parampublic override void ModifyCurrentRunRecord(Cognex.VisionPro.ICogRecord currentRecord){}#endregion#region When the Last Run Record is Created/// summary/// Called when the last run record may have changed and is being reconstructed/// /summary/// param namelastRecord/// The new last run record is available to be initialized or customized./parampublic override void ModifyLastRunRecord(Cognex.VisionPro.ICogRecord lastRecord){foreach(ICogGraphic s in dt){mToolBlock.AddGraphicToRunRecord(s, lastRecord, CogImageConvertTool1.InputImage, );}}#endregion#region When the Script is Initialized/// summary/// Perform any initialization required by your script here/// /summary/// param namehostThe host tool/parampublic override void Initialize(Cognex.VisionPro.ToolGroup.CogToolGroup host){// DO NOT REMOVE - Call the base class implementation first - DO NOT REMOVEbase.Initialize(host);// Store a local copy of the script hostthis.mToolBlock ((Cognex.VisionPro.ToolBlock.CogToolBlock)(host));}#endregion}
http://www.w-s-a.com/news/539592/

相关文章:

  • 长春网站建设公司怎么样电商网站建设与开发期末考试
  • 品牌网站建设搭建国内外网站建设
  • 辽宁人社app一直更新整站seo定制
  • 兰州网站建设论坛装修品牌
  • 云南省城乡住房与建设厅网站用什么网站可以做电子书
  • 自己电脑怎么做网站服务器吗0基础如何做网站
  • 做网站的股哥网络整合营销方案策划
  • 网站你懂我意思正能量晚上唯品会网站开发费用
  • 网站认证金额怎么做分录网页无法访问是怎么回事
  • 樟木头建网站的wordpress自适应吸附菜单
  • 番禺网站设计威海微网站建设
  • 新乡网站建设服务网站建设的点子
  • 赛罕区城乡建设局网站什么是新媒体运营
  • 松原企业网站建设设计素材网排名
  • 网站建设是那个行业广东公司排名
  • 制作网站要多少钱seo是如何优化
  • 求个网站2020急急急做金融网站拘留多久
  • 网站后台管理系统怎么进seo网络推广外包公司
  • 中山市 做网站网站建设如何上传文件
  • 网站呢建设公众号制作要求
  • 网站备案证明在自己电脑上做网站
  • 沈阳旅游团购网站建设怎么制作网站搜索窗口
  • 做化学合成的网站有哪些枣庄住房和城乡建设局网站
  • 天猫优惠券网站怎么做的网络连接
  • 保定网站建设多少钱公司网页网站建设+ppt模板下载
  • 用户上传商品网站用什么做建设跳转公积金网站
  • 买程序的网站上海市网站建设公司
  • 南通网站建设排名公司哪家好wordpress网站图片迁移
  • 河南省汝州文明建设门户网站博客网站建设源码
  • 单位建设网站的请示手机移动端网站案例