当前位置:网站首页>视觉上位系统设计开发(halcon-winform)
视觉上位系统设计开发(halcon-winform)
2022-07-03 15:08:00 【11eleven】
- 本文介绍如何实现一个视觉上位的方案配置系统的思路,基于C# winform,原生控件进行界面设计,流程UI交互,以及算子调用,设备通讯等等。
- 设计的思路大致是基于视觉库的算子,将算子封装成单个工具节点,例如图像导入,颜色转换,区域绘制,阈值分析,结果判断等等,可根据项目情况进行自定义节点的输入参数,运行参数,从而执行得到执行结果。另外加上设备通讯的驱动全局变量的流转,最后结果的输出完成整个的检测工作。
- 视觉上位的模块大致划分为以下几个模块
- 方案流程管理
- 流程节点关系
- 全局变量管理
- 图像绘制预览功能
- 设备通讯控制
- 节点算子执行方法
- 结果输出,图像输出
- 先上几张效果图。后续文章将从这几个块进行功能解析。
- 数据对象有:方案,流程、流程节点、节点基础信息、设备信息、设备事件信息、算子匹配的函数、全局变量、等等
public class SchemeConfig {
public static SchemeInfo Scheme { set; get; }
public static HWindow_Final HWindowControl { set; get; }}
public class SchemeInfo : BaseField, IEntity<long>
{public SchemeInfo()
{
Id = GeneratePrimaryKeyIdHelper.GetPrimaryKeyId();
}
public long Id { get; set; }
/// <summary>
/// 方案编码
/// </summary>
public string Code { get; set; }/// <summary>
/// 方案名称
/// </summary>
public string Name { get; set; }/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
public List<SchemeFlowInfoEntity> FlowList { set; get; }
public List<GlobalVariableModel> GlobalVariableList { set; get; }/// <summary>
/// 设备配置
/// </summary>
public GlobalDeviceConfig GlobalDeviceConfig { set; get; }}
public class GlobalDeviceConfig
{
public List<DeviceCommumicationClient> ClientList { set; get; } = new List<DeviceCommumicationClient>();
public List<CommumicationEventReceive> ReceiveList { set; get; } = new List<CommumicationEventReceive>();
public List<CommumicationEventSend> SendList { set; get; } = new List<CommumicationEventSend>();
}/// <summary>
/// 图像源
/// </summary>
public class ImageSourceContentModel: SchemeFlowNodeEntity
{
public override void InitData() {
NodeResultModels = new List<NodeResultModel>();
NodeResultModels.Add(new NodeResultModel() { NodeResultCode = NodeResultTypeEnum.ImageWidth.ToString(),NodeResultName =NodeResultTypeEnum.ImageWidth.GetDescription() });
NodeResultModels.Add(new NodeResultModel() { NodeResultCode = NodeResultTypeEnum.ImageHeight.ToString(), NodeResultName = NodeResultTypeEnum.ImageHeight.GetDescription() });
}
public int DefaultImageIndex { set; get; } = -1;
public string ImageFolderPath { set; get; }
/// <summary>
/// 图像地址PATH
/// </summary>
public List<string> ImagePathList { set; get; }}
/// <summary>
/// 几何创建
/// </summary>
public class GeometryContentModel : SchemeFlowNodeEntity
{/// <summary>
/// ROIJSON
/// </summary>
public string RoiDataJson { set; get; }/// <summary>
/// ROI几何
/// </summary>
public List<ROI> Regions { set; get; } = new List<ROI>();//roi集合}
/// <summary>
/// blob
/// </summary>
public class BlobContentModel : SchemeFlowNodeEntity
{public override void InitData()
{
}
}/// <summary>
/// 颜色转换
/// </summary>
public class ColorRgbContentModel : SchemeFlowNodeEntity
{
}/// <summary>
/// Result
/// </summary>
public class ConditionResultContentModel : SchemeFlowNodeEntity
{
/// <summary>
/// 判断条件 0:全部符合,1:任意条件符合
/// </summary>
public int JudgeType { set; get; }public List<ResultConditionJudgeModel> JudgeList { set; get; } = new List<ResultConditionJudgeModel>();
public Color OkColor { set; get; }
public Color NgColor { set; get; }
public int ResultLocationX { set; get; }
public int ResultLocationY { set; get; }
}public class ResultConditionJudgeModel {
public string VariableCode { set; get; }
public string VariableName { set; get; }
public decimal MinValue { set; get; }
public decimal MaxValue { set; get; }
}
/// <summary>
/// 工具节点类型
/// </summary>
public enum ToolNodeTypeEnum:long
{
/// <summary>
/// 图像源
/// </summary>
ImageSource=0,
/// <summary>
/// 几何
/// </summary>
Geometry=1,
/// <summary>
/// blob分析
/// </summary>
Blob=2,
/// <summary>
/// 条件结果
/// </summary>
ConditionResult=3,
/// <summary>
/// 颜色转换
/// </summary>
ColorRgb=4,
}

边栏推荐
- [set theory] inclusion exclusion principle (complex example)
- Using TCL (tool command language) to manage Tornado (for VxWorks) can start the project
- There are links in the linked list. Can you walk three steps faster or slower
- [ue4] HISM large scale vegetation rendering solution
- Remote server background hangs nohup
- Finally, someone explained the financial risk management clearly
- Vs+qt application development, set software icon icon
- [ue4] Niagara's indirect draw
- 什么是Label encoding?one-hot encoding ,label encoding两种编码该如何区分和使用?
- [transform] [NLP] first proposed transformer. The 2017 paper "attention is all you need" by Google brain team
猜你喜欢
随机推荐
Byte practice surface longitude
Yolov5系列(一)——網絡可視化工具netron
App全局异常捕获
Leetcode the smallest number of the rotation array of the offer of the sword (11)
High quality workplace human beings must use software to recommend, and you certainly don't know the last one
什么是embedding(把物体编码为一个低维稠密向量),pytorch中nn.Embedding原理及使用
Puppet自动化运维排错案例
Using notepad++ to build an arbitrary language development environment
C string format (decimal point retention / decimal conversion, etc.)
远程服务器后台挂起 nohup
Construction of operation and maintenance system
复合类型(自定义类型)
Mmdetection learning rate and batch_ Size relationship
406. Reconstruct the queue according to height
2022/02/14
Several sentences extracted from the book "leather bag"
Chapter 14 class part 1
Yolov5 advanced nine target tracking example 1
Solve the problem that pushgateway data will be overwritten by multiple push
Tencent internship interview sorting









