首页 > Web开发 > 详细

Visionpro相机取像操作,.NET4.0

时间:2019-06-19 09:01:19      阅读:661      评论:0      收藏:0      [点我收藏+]
        private string path = AppDomain.CurrentDomain.BaseDirectory + "12.vpp";
        private string path1 = AppDomain.CurrentDomain.BaseDirectory + "CCD.vpp";
        private string path2 = AppDomain.CurrentDomain.BaseDirectory + "Tool.vpp";
        private CogToolBlock tb;
        private CogToolBlock tb1;
        private CogAcqFifoTool acq;
        private CogAcqFifoTool acq1;
        public Form1()
        {
            InitializeComponent();
            //序列化CogFifoTool 工具
            tb = CogSerializer.LoadObjectFromFile(path) as CogToolBlock;
            //加载到CogToolBlockEdit控件中
            cogToolBlockEditV21.Subject = tb;
        // 转换成取像
            acq = tb.Tools[0] as CogAcqFifoTool;





        }

        private void button1_Click(object sender, EventArgs e)
        {
            acq.Run();
            cogRecordDisplay1.Image = acq.OutputImage;
            cogRecordDisplay1.Fit();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            //初始化相机工具
            acq1 = CogSerializer.LoadObjectFromFile(path1) as CogAcqFifoTool;
            acq1.Run();
            cogRecordDisplay1.Image = acq1.OutputImage;
            cogRecordDisplay1.Fit();
        }

        private void btnLive_Click(object sender, EventArgs e)
        {
            //相机实时状态
            if (cogRecordDisplay1.LiveDisplayRunning)
            {

                cogRecordDisplay1.StopLiveDisplay();
                btnLive.BackColor = Color.Gray;
            }
            else
            {
                cogRecordDisplay1.StartLiveDisplay(acq.Operator, true);
                btnLive.BackColor = Color.Green;
            }
          //  cogRecordDisplay1.StartLiveDisplay(acq.Operator);
        }

        private void btnStop_Click(object sender, EventArgs e)
        {
            //关闭实时状态
            cogRecordDisplay1.StopLiveDisplay();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            acq.Run();
            tb1.Inputs["InputImage"].Value = acq.OutputImage;
            tb1.Run();
        cogRecordDisplay1.Record = tb1.CreateLastRunRecord().SubRecords[1];

            //显示运行记录
            //cogRecordDisplay1.Image = acq.OutputImage;
            //cogRecordDisplay1.Record = tb1.CreateLastRunRecord();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            tb1 = CogSerializer.LoadObjectFromFile(path2) as CogToolBlock;
            cogToolBlockEditV22.Subject = tb1;
        }
    

  

Visionpro相机取像操作,.NET4.0

原文:https://www.cnblogs.com/MyVision/p/11049299.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!