当前位置: 首页> 汽车> 时评 > 营销网站 建设 高端_视频剪辑软件app_武汉关键词排名工具_培训师资格证怎么考

营销网站 建设 高端_视频剪辑软件app_武汉关键词排名工具_培训师资格证怎么考

时间:2025/7/12 9:32:26来源:https://blog.csdn.net/2403_88923953/article/details/146046287 浏览次数: 0次
营销网站 建设 高端_视频剪辑软件app_武汉关键词排名工具_培训师资格证怎么考

 VisionPro

VisionMaster


分类:大球刀、小球刀、尖刀、三角刀 

VisionPro  实现

使用多模板匹配工具

 设置参数

小球刀

 大球刀

尖刀

三角刀

  

右键添加终端

代码实现

1.声明文本显示
 CogGraphicLabel label = new CogGraphicLabel();
 2.找到工具
CogPMAlignMultiTool pma = mToolBlock.Tools["CogPMAlignMultiTool1"]as CogPMAlignMultiTool;
3.声明类名
   string s = pma.Results.PMAlignResults[0].ModelName;label.Alignment = CogGraphicLabelAlignmentConstants.TopLeft;label.SetXYText(10, 10, s);label.Color = CogColorConstants.Red;
4.显示图片上
 mToolBlock.AddGraphicToRunRecord(label, lastRecord, "CogPMAlignMultiTool1.InputImage", "");
5.总体需要写的代码
CogGraphicLabel label = new CogGraphicLabel();
CogPMAlignMultiTool pma = mToolBlock.Tools["CogPMAlignMultiTool1"]as CogPMAlignMultiTool;
string s = pma.Results.PMAlignResults[0].ModelName;label.Alignment = CogGraphicLabelAlignmentConstants.TopLeft;label.SetXYText(10, 10, s);label.Color = CogColorConstants.Red;
mToolBlock.AddGraphicToRunRecord(label, lastRecord, "CogPMAlignMultiTool1.InputImage", "");
给大家放的cv代码
#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.PMAlign;
#endregionpublic class CogToolBlockAdvancedScript : CogToolBlockAdvancedScriptBase
{#region Private Member Variablesprivate Cognex.VisionPro.ToolBlock.CogToolBlock mToolBlock;#endregionCogGraphicLabel 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();// #endifCogPMAlignMultiTool pma = mToolBlock.Tools["CogPMAlignMultiTool1"]as CogPMAlignMultiTool;// Run each tool using the RunTool functionforeach(ICogTool tool in mToolBlock.Tools)mToolBlock.RunTool(tool, ref message, ref result);string s = pma.Results.PMAlignResults[0].ModelName;label.Alignment = CogGraphicLabelAlignmentConstants.TopLeft;label.SetXYText(10, 10, s);label.Color = CogColorConstants.Red;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){mToolBlock.AddGraphicToRunRecord(label, lastRecord, "CogPMAlignMultiTool1.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}

VisionMaster 实现

 

 

 点击运行,进行下面的操作

 

关键字:营销网站 建设 高端_视频剪辑软件app_武汉关键词排名工具_培训师资格证怎么考

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: