一杯清酒邀明月
天下本无事,庸人扰之而烦耳。
 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 }

 

posted on 2021-01-18 16:09  一杯清酒邀明月  阅读(551)  评论(0编辑  收藏  举报