zoukankan      html  css  js  c++  java
  • VisionPro 相机硬件触发笔记

     1 using Cognex.VisionPro;
     2 using Cognex.VisionPro.FGGigE;
     3 using Cognex.VisionPro.FGGigE.Implementation.Internal;
     4 using Cognex.VisionPro.ToolBlock;
     5 using System;
     6 using System.Collections.Generic;
     7 using System.ComponentModel;
     8 using System.Data;
     9 using System.Drawing;
    10 using System.Linq;
    11 using System.Text;
    12 using System.Windows.Forms;
    13 
    14 namespace 康耐视硬件触发测试
    15 {
    16     public partial class Form1 : Form
    17     {
    18         CogToolBlock tb = null;
    19         CogAcqFifoTool acq = null;
    20         CogAcqFifoTool tacq = null;
    21 
    22         private string path = Application.StartupPath + "\Tool\" + "tb.vpp";
    23         private string pathAcq = AppDomain.CurrentDomain.BaseDirectory + "\Tool\" + "acq.vpp";
    24         public Form1()
    25         {
    26             InitializeComponent();
    27             try
    28             {
    29                 tb = CogSerializer.LoadObjectFromFile(path) as CogToolBlock;
    30                 cogToolBlockEditV21.Subject = tb;
    31                 acq = CogSerializer.LoadObjectFromFile(pathAcq) as CogAcqFifoTool;
    32                 cogAcqFifoEditV21.Subject = acq;
    33             }
    34             catch (Exception ex)
    35             {
    36 
    37                 MessageBox.Show(ex.Message);
    38             }
    39 
    40 
    41         }
    42 
    43         private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    44         {
    45             CogFrameGrabberGigEs cameras = new CogFrameGrabberGigEs();
    46 
    47             try
    48             {
    49                 foreach (CogFrameGrabberGigE item in cameras)
    50                 {
    51                     item.Disconnect(false);
    52                 }
    53 
    54             }
    55             catch (Exception ex)
    56             {
    57 
    58             }
    59         }
    60 //方法参数,添加相机触发事件
    61         private void AcqRun(object sender, CogCompleteEventArgs e)
    62         {
    63             acq.Run();
    64             cogRecordDisplay1.Image = acq.OutputImage;
    65             cogRecordDisplay1.Fit();
    66 
    67         }
    68 
    69         private void ToolAcq(object sender, CogCompleteEventArgs e)
    70         {
    71             tacq = tb.Tools["CogAcqFifoTool1"] as CogAcqFifoTool;
    72             tacq.Run();
    73             cogRecordDisplay2.Image = tacq.OutputImage;
    74             cogRecordDisplay2.Fit();
    75 
    76         }
    77 
    78 
    79         private void Form1_Load(object sender, EventArgs e)
    80         {
    81             //acq.Operator.Complete += new CogCompleteEventHandler(ToolAcq);
    82             //acq.Operator.Complete += new CogCompleteEventHandler(AcqRun);
    83             tacq = tb.Tools["CogAcqFifoTool1"] as CogAcqFifoTool;
    84 
    85             tacq.Operator.Complete += new CogCompleteEventHandler(ToolAcq);
    86 
    87         }
    88 
    89 
    90     }
    91 }
  • 相关阅读:
    MVC+EasyUI 菜单导航的实现
    MVC4 +EasyUI 使用TreeGrid 方法
    MYSQL 内存报错 Use 'mysqld --thread_stack=#' to specify a bigger stack.
    System.Data.EntityState”在未被引用的程序集中定义
    android 学习第一天 了解事件机制,页面跳转等常用操作
    EasyUI TreeGrid DataTable转换数据实现案例
    王慧文清华大学的演讲的观点摘要
    《自由选择》
    优秀的工程师
    【mark】Windows Exploitation, post exploitation sites for reference
  • 原文地址:https://www.cnblogs.com/ybqjymy/p/14293268.html
Copyright © 2011-2022 走看看