VisionPro开发实战:CogRecordDisplay控件显示与保存图片的完整流程(附C#代码示例)

VisionPro + C#:联合c#进行简易二次开发 文章目录前言一、在Visual Studio的工具箱中加入VisionPro的控件二、使用VisionPro的控件进行二次开发1.准备事项2.代码编写1、添加引用总结 前言 提示:这里可以添加本文要记录的大概内容: 例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。 提示:以下是本篇文章正文内容,下面案例可供参考 一、在Visual Studio的工具箱中加入VisionPro的控件 这部分直接参考:https://blog.csdn 阅读详情

VisionPro开发实战:CogRecordDisplay控件图像处理全流程解析

在工业视觉应用开发领域,Cognex VisionPro凭借其强大的图像处理能力和灵活的控件体系,已成为众多自动化检测系统的核心工具。其中,CogRecordDisplay控件作为图像展示与交互的关键组件,其正确使用直接关系到整个视觉系统的用户体验和功能完整性。本文将深入探讨如何在实际项目中高效利用该控件完成图像加载、显示优化、动态清屏以及结果保存等全流程操作,并提供可直接集成到生产环境中的C#代码解决方案。

1. 开发环境准备与基础配置

1.1 工具链集成要点

VisionPro开发需要确保开发环境正确配置,以下是关键组件清单:

  • VisionPro 9.0+:基础图像处理库
  • Visual Studio 2019/2022:推荐使用社区版或专业版
  • .NET Framework 4.7.2+:兼容性最佳版本
  • Cognex控件包:通过NuGet或安装包集成

在新建项目时,务必添加以下关键引用:

using Cognex.VisionPro;
using Cognex.VisionPro.Display;
using Cognex.VisionPro.ImageFile;

1.2 控件初始化最佳实践

CogRecordDisplay控件的初始化不仅需要添加到窗体,还需进行性能优化配置:

private CogRecordDisplay cogRecordDisplay;

private void InitializeDisplayControl()
{
    cogRecordDisplay = new CogRecordDisplay
    {
        Dock = DockStyle.Fill,
        AutoFit = true,  // 启用自适应缩放
        DoubleTapZoomEnabled = true,  // 允许双击缩放
        PixelGridSnapEnabled = false  // 根据需求配置网格对齐
    };
    this.Controls.Add(cogRecordDisplay);
}

注意:在高分辨率显示设备上,建议设置HighQualityRendering属性为true以获得更清晰的图像渲染效果。

2. 图像加载与显示优化策略

2.1 多格式图像加载实现

VisionPro支持多种工业标准图像格式,以下代码展示了健壮的加载流程:

public CogImage8Grey LoadImageFile(string filePath)
{
    if (!File.Exists(filePath))
        throw new FileNotFoundException("指定图像文件不存在");

    try
    {
        using (CogImageFileTool imageTool = new CogImageFileTool())
        {
            imageTool.Operator.Open(filePath, CogImageFileModeConstants.Read);
            imageTool.Run();
            
            if (imageTool.OutputImage is C
C#二开VisionPro:CogRecordDisplay图像显示与保存全流程指南 在机器视觉上位机开发中,图像显示与结果保存直接关系到系统的可观测性和数据追溯能力。对于使用C#进行WinForms二次开发的工程师而言,VisionPro提供的CogRecordDisplay控件是承接检测结果展示与现场截图的核心组件。该控件继承自CogDisplay,支持ICogImage显示、静态图形叠加,并可与CogJobManager联动自动刷新工具输出。文章从控件选型背景出发,介绍C#工程引用配置、显示图像与叠加图形的代码写法、三种保存图片的方式,以及黑屏、跨线程、内存泄漏等高频异常的处理策略,帮 阅读详情

相关推荐

学习VISIONPRO各控件的C#中类库--应用(CogImageFileTool,CogImageConvert,图片显示cogRecordDisplay)

我使用VISIONPRO 的版本为9.0;往往很多USB相机没有办法使用,我们可以采用拍图在文档下再同步抓取图片,再使用。 1.实现配置好CogImageFileTool工具,保存在文档中为img.vpp,步骤如下4步。 CogImageFileTool 序列化回来: CogImageFileTool file1 = (CogImageFileTool)CogSerializer.Lo...

tuto7534的博客 8583

[VisionPro与C#]关于C#使用VisionPro控件显示图片过程的一些理解

将当前CogToolBlock的Record显示在RecordDisplay控件上:(代码如下) cogRecordDisplay1.Record = m_tb.CreateLastRunRecord().SubRecords[0]; 理解如下: 1.cogRecordDisplay1.Record 指定要显示的具体记录, m_tb为CogToolBlock类型的对象 2.这里使用了CogRecordDisplay控件,可以显示一张图片以及这张图片上的图像子记录,这里虽然知道SubRecords显示的为子

mmmm0584的博客 1万+

[VisionPro与C#]深入解析CogRecordDisplay控件中SubRecords的图像处理机制

本文深入解析了VisionPro中CogRecordDisplay控件处理SubRecords图像数据的核心机制。通过剖析SubRecords的层次化数据结构,解释了为何必须使用SubRecords[0]来显示图像,并提供了动态切换显示源、并列显示原图与结果、提取保存图像等实战技巧,帮助开发者高效利用该控件进行视觉应用调试与开发。

uber9的博客 458

Cognex VisionPro实战:CogRecordDisplay中十字线与Marker的动态绘制与高效管理

本文深入探讨了在Cognex VisionPro的CogRecordDisplay控件中动态绘制与管理十字线和Marker的实战技巧。文章详细解析了图形层原理、坐标转换关键,并提供了优化后的健壮代码模块,帮助开发者实现高效、可维护的工业视觉界面交互与结果可视化。

tomato的博客 740

Visionpro二次开发入门:从零构建Windows窗体图像处理工具

本文详细介绍了Visionpro二次开发的入门实践,指导开发者如何利用C#和Windows窗体应用,从零构建一个自定义的图像处理工具。文章涵盖了开发环境搭建(VS2022)、Visionpro控件集成、界面设计以及核心的图像加载、增强与保存逻辑代码实现,帮助读者快速掌握将Visionpro强大算法封装为专用应用程序的技能。

weixin_29310605的博客 323

VisionPro二次开发实战:从图形化到代码,解决数据传递与数组输出难题

工业视觉系统开发中,软件平台与定制化需求的集成是关键挑战。其核心原理在于通过编程接口调用底层视觉算法库,实现对图像处理流程的灵活控制,从而突破图形化工具的局限性,满足与MES、PLC等外部系统深度集成的技术需求。这种二次开发能力在自动化检测、精密测量和生产线监控等场景中价值显著,能够高效处理复杂的视觉任务和数据流。本文聚焦于VisionPro平台,通过一个完整的齿轮尺寸检测案例,深入探讨了如何搭建开发环境、理解对象模型,并重点解决了工具结果数组的高效传递与处理等工程实践问题,例如处理CogCaliperTo

weixin_34290631的博客 473

C#与康耐视Visionpro-CogRecordDisplay控件显示及图片保存

C#与康耐视Visionpro-CogRecordDisplay控件显示及图片保存

视觉人机器视觉的博客 2715

C#集成VisionPro视觉检测:从QuickBuild到上位机实战

机器视觉在工业自动化中扮演核心角色,视觉检测与定位引导需求广泛。VisionPro作为主流视觉开发库,其QuickBuild原型开发便捷,但将原型集成到C#上位机时,常遇到采集黑屏、ToolBlock参数传递异常、UI卡顿等问题。VisionPro提供完整的.NET程序集,C#可加载.vpp文件,通过CogJobManager和CogToolBlock管理视觉流程,利用CogAcqFifo控制相机采集,并使用PMAlign等工具完成模板匹配与测量。其技术价值在于,将视觉算法封装为可编程对象,既保留Quick

weixin_33290540的博客 261

基于深度学习方法(7种)的高光谱与多光谱图像融合(附代码+3个数据集获取)

其他不懂的可以把代码发给AI哦,让它给你解读。

热爱分享,热爱记录 1302

一文入门BMS(电池管理系统)

本文章是基于曾师兄的文稿《具有组网扩展功能的新能源汽车电池管理系统》而写的文章。该文章主要是对BMS(Battery Management System,电池管理系统)做一些简要的介绍,借此助各位也助我入门BMS。有纰漏请指出,转载请说明。学习交流请发邮件 1280253714@qq.com。

weixin_45817947的博客 2万+

产品失效你必须要知道的概念---MTBF、MTTF和FIT

如果我们想知道该电路在10年后仍能正常工作的几率,按照前面例子的相同计算步骤,结果将是90.3%。例如,假设一个TDK电容器的MTBF为6918年(16.5失效时间间隔,FIT),这并不意味着该电容器能持续这么久(显然,没有人能够对部件进行这么长时间的测试)。综上,MTBF和MTTF是用来描述系统或设备级别的故障间隔时间,而FIT是用来描述某单一器件的失效率的单位。MTBF和MTTF使用相同的计算方法,但MTBF用于可维修的产品,而MTTF用于不可维修或维修成本过高的产品。

weixin_49761275的博客 3842

安路TangDynasty和FD和JTAG驱动器安装

安路FPGA产品矩阵包含SALPHOENIX高性能、SALEAGLE高性价比和SALELF低功耗三大系列,广泛应用于网络通信、消费电子等领域。配套的TangDynasty(TD)集成开发环境支持标准设计输入,提供完整优化流程与调试工具。简要介绍了TD 6.2.1版本的安装步骤。

wangjie36的博客 1052

基于Simulink的强化学习(DQN)自主调节占空比

摘要:本文介绍了一种基于Simulink的强化学习(DQN)方法,用于Buck变换器的自主占空比调节。通过建立马尔可夫决策过程模型,设计了包含状态、动作和奖励函数的强化学习框架,并在Simulink中实现了Buck主电路、RL接口模块和DQN智能体的集成。实验表明,相比传统PID控制,DQN方法在负载突变和输入跌落等复合扰动下表现出更好的鲁棒性,电压超调小于1%,恢复时间缩短至0.3ms。文章还详细讨论了关键设计技巧、工程挑战及对策,并提出了多目标优化、先进算法应用等扩展方向,为智能电源控制提供了新思路。

amy_mhd的博客 77

从登录到应用可见:在 SAP S/4HANA Cloud Private Edition 中创建用户与打通 SAP Fiori 权限的完整思路

在SAP S/4HANA系统中,用户创建远非简单的账号开通,而是涉及认证、授权、数据访问等多维度的复杂过程。用户主数据记录(User Master Record)是系统访问的起点,包含登录方式、角色分配等关键信息。认证解决"你是谁"的问题,授权则决定"你能做什么"。SAP Fiori访问链路涉及Launchpad内容分配、应用启动映射、OData服务权限等多层校验。角色(Role)通过PFCG维护,包含业务目录(Catalog)和空间(Space)等元素,共同构成完整

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 152

Nature、science、cell旗下刊物

Nature\science\cell子刊说明

计算机视觉 5616

uniapp [全端兼容] - 实现省市区选择器三四级联动组件,uniapp选择地址自定义省市区三级联动插件,弹框式多级联动选择器区域选择(全平台兼容苹果安卓App、支付宝微信小程序、移动端H5网页)

uni-app省市区选择器,省市区街道三级四级联动选择器,uniapp自定义多列选择器省市两级联动,uniapp picker组件实现多级联动,h5移动端网页,微信小程序,支付宝小程序,Android安卓,苹果ios,app,nvue,uniApp选择器省市区县街道乡镇,uniapp实现省市区选择联动,uniapp城市三级联动(自定义组件)_uniapp三级联动,picker插件省市区联动,uniapp小程序省市区选择器,uni-app 省市区街道的四级联动选择,uniapp怎样实现省市区地址三级联动uni

🏆 前端领域优质创作者 1万+

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

上一篇: 手把手教你用ABAP函数在自定义屏幕中集成SAP中央地址管理(ADRC)
下一篇: Windows 10/11、Mac、Linux全平台实测:WindTerm 2.5.0便携版到底香不香?(附透明窗口、锁屏密码重置教程)
这个写手不太冷
博客等级 码龄7年 31粉丝 1435原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址