zoukankan      html  css  js  c++  java
  • VisionPro 相机取像操作,.NET4.0

     1 private string path = AppDomain.CurrentDomain.BaseDirectory + "12.vpp";
     2 private string path1 = AppDomain.CurrentDomain.BaseDirectory + "CCD.vpp";
     3 private string path2 = AppDomain.CurrentDomain.BaseDirectory + "Tool.vpp";
     4 private CogToolBlock tb;
     5 private CogToolBlock tb1;
     6 private CogAcqFifoTool acq;
     7 private CogAcqFifoTool acq1;
     8 public Form1()
     9 {
    10     InitializeComponent();
    11     //序列化CogFifoTool 工具
    12     tb = CogSerializer.LoadObjectFromFile(path) as CogToolBlock;
    13     //加载到CogToolBlockEdit控件中
    14     cogToolBlockEditV21.Subject = tb;
    15 // 转换成取像
    16     acq = tb.Tools[0] as CogAcqFifoTool;
    17  
    18  
    19  
    20  
    21  
    22 }
    23  
    24 private void button1_Click(object sender, EventArgs e)
    25 {
    26     acq.Run();
    27     cogRecordDisplay1.Image = acq.OutputImage;
    28     cogRecordDisplay1.Fit();
    29 }
    30  
    31 private void button2_Click(object sender, EventArgs e)
    32 {
    33     //初始化相机工具
    34     acq1 = CogSerializer.LoadObjectFromFile(path1) as CogAcqFifoTool;
    35     acq1.Run();
    36     cogRecordDisplay1.Image = acq1.OutputImage;
    37     cogRecordDisplay1.Fit();
    38 }
    39  
    40 private void btnLive_Click(object sender, EventArgs e)
    41 {
    42     //相机实时状态
    43     if (cogRecordDisplay1.LiveDisplayRunning)
    44     {
    45  
    46         cogRecordDisplay1.StopLiveDisplay();
    47         btnLive.BackColor = Color.Gray;
    48     }
    49     else
    50     {
    51         cogRecordDisplay1.StartLiveDisplay(acq.Operator, true);
    52         btnLive.BackColor = Color.Green;
    53     }
    54   //  cogRecordDisplay1.StartLiveDisplay(acq.Operator);
    55 }
    56  
    57 private void btnStop_Click(object sender, EventArgs e)
    58 {
    59     //关闭实时状态
    60     cogRecordDisplay1.StopLiveDisplay();
    61 }
    62  
    63 private void button3_Click(object sender, EventArgs e)
    64 {
    65     acq.Run();
    66     tb1.Inputs["InputImage"].Value = acq.OutputImage;
    67     tb1.Run();
    68 cogRecordDisplay1.Record = tb1.CreateLastRunRecord().SubRecords[1];
    69  
    70     //显示运行记录
    71     //cogRecordDisplay1.Image = acq.OutputImage;
    72     //cogRecordDisplay1.Record = tb1.CreateLastRunRecord();
    73 }
    74  
    75 private void Form1_Load(object sender, EventArgs e)
    76 {
    77     tb1 = CogSerializer.LoadObjectFromFile(path2) as CogToolBlock;
    78     cogToolBlockEditV22.Subject = tb1;
    79 }
  • 相关阅读:
    selenium基础(鼠标和键盘事件)
    Java:面向对象三大特征
    Java:面向对象(上)
    Java:数组
    Java:方法
    Java基础:程序结构控制
    Java基础:用户交互Scanner
    Java基础语法(下)
    Jenkins(Extended E-mail Notification)邮箱配置正确但是并没有发送邮件
    接口自动化测试与Jenkins集成(Freestyle project任务版)
  • 原文地址:https://www.cnblogs.com/ybqjymy/p/14293252.html
Copyright © 2011-2022 走看看