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

金安区住房和城乡建设局网站百度seo排名优化软件分类

金安区住房和城乡建设局网站,百度seo排名优化软件分类,东莞回收网站设计,网上兼职网站怎么做的划痕检测,我这里用到的是Sobel算子和blob斑点匹配以及blob里面的形态学调整 Sobel 是一种在数字图像处理和计算机视觉领域广泛应用的算法,主要用于边缘检测 脚本展示 #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 name="message">Sets the Message in the tool's RunStatus.</param>/// <param name="result">Sets the Result in the tool's RunStatus</param>/// <returns>True if the tool should run normally,///          False if GroupRun customizes run behavior</returns>public 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 name="currentRecord">/// The new currentRecord is available to be initialized or customized.</param>public 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 name="lastRecord">/// The new last run record is available to be initialized or customized.</param>public 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 name="host">The host tool</param>public 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 name="message">Sets the Message in the tool's RunStatus.</param>/// <param name="result">Sets the Result in the tool's RunStatus</param>/// <returns>True if the tool should run normally,///          False if GroupRun customizes run behavior</returns>public 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 name="currentRecord">/// The new currentRecord is available to be initialized or customized.</param>public 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 name="lastRecord">/// The new last run record is available to be initialized or customized.</param>public 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 name="host">The host tool</param>public 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 name="message">Sets the Message in the tool's RunStatus.</param>/// <param name="result">Sets the Result in the tool's RunStatus</param>/// <returns>True if the tool should run normally,///          False if GroupRun customizes run behavior</returns>public 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 name="currentRecord">/// The new currentRecord is available to be initialized or customized.</param>public 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 name="lastRecord">/// The new last run record is available to be initialized or customized.</param>public 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 name="host">The host tool</param>public 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.dtcms.com/wzjs/289381.html

相关文章:

  • 深圳 外贸 网站建设 龙关键词seo排名优化推荐
  • 建筑建材网站设计费用百度登录入口官网
  • 小网站做长尾词还是流量词对网站提出的优化建议
  • 牡丹江seo网站推广蜘蛛屯优化排名新闻稿发布软文平台
  • 成都优化官网公司外贸网站优化
  • 南安网站设计全网营销系统怎么样
  • 一般网站的前台功能模块全网推广平台推荐
  • 网页商城设计商城网站设计案例什么是网络营销战略
  • 网站建设项目策划书范文网络营销的八种方式
  • 汝州市住房和城乡规划建设局网站网络营销策略分析报告
  • 在马来西亚做博彩网站合法吗抖音推广引流平台
  • 产品seo怎么优化重庆网站优化
  • 有做网站设计吗网络营销师
  • 烟台网站建设报价官网关键词优化价格
  • 建站公司成功案例百度网站的域名地址
  • 做传奇网站云服务器地域改选哪里网站seo方案模板
  • 杭州h5建站在线咨询广州网站建设工作室
  • B2C购物网站的特色seo优化实训总结
  • 网站开发 在线数据库如何搭建一个自己的网站
  • 制作网站建设规划书关键词优化靠谱推荐
  • 攻击wordpress网络优化器
  • 网站群发手机短信化妆品软文推广范文
  • 做影视网站关停不需要验证码的广告平台
  • 南阳在线网站制作sem是什么基团
  • 什么网站可以做外国生意网络营销专业毕业论文
  • 电商建站系统百度搜索页
  • 政务信息网站建设方案搜索引擎优化是什么意思
  • 资溪县建设局网站如何推广品牌知名度
  • 深圳做网站的好公司有哪些北京seo网络优化师
  • 网站建设中单页面济南seo关键词优化方案