Esempio n. 1
0
        //相机初始化
        public void CameraInitialize(TIS.Imaging.ICImagingControl icImagingControl1)
        {
            try
            {
                icImagingControl1.LoadDeviceStateFromFile("device1.xml", true); //从文件加载相机文件,默认保存在当前工程中,也可以保存到绝对路径中
            }
            catch (Exception)                                                   //捕捉加载文件错误信息
            {
                icImagingControl1.ShowDeviceSettingsDialog();                   //相机选择窗口
                if (!icImagingControl1.DeviceValid)
                {
                    MessageBox.Show("没有找到设备");
                    Application.Exit();
                }
                else
                {
                    icImagingControl1.SaveDeviceStateToFile("device1.xml");//保存相机参数到xml文件
                }
            }
            //SN号打开相机
            //OpenBySN(icImagingControl1, "37814466");

            //初始化控件
            icImagingControl1.LiveCaptureContinuous = true;  //设置回调模式
            icImagingControl1.LiveDisplayDefault    = false; //取消窗口默认大小显示
            //初始化设置
            icImagingControl1.LiveDisplayHeight = icImagingControl1.Height;
            icImagingControl1.LiveDisplayWidth  = icImagingControl1.Width;
            icImagingControl1.MemoryCurrentGrabberColorformat = TIS.Imaging.ICImagingControlColorformats.ICRGB32;//黑白格式为:ICY8;彩色格式为:ICRGB32
        }
Esempio n. 2
0
 public void CameraPara(TIS.Imaging.ICImagingControl icImagingControl1)
 {
     //文件打开相机
     try
     {
         icImagingControl1.LoadDeviceStateFromFile("device1.xml", true);
     }
     catch (Exception)
     {
         // icImagingControl1.ShowDeviceSettingsDialog();
         if (!icImagingControl1.DeviceValid)
         {
             MessageBox.Show("没有找到设备");
         }
         else
         {
             icImagingControl1.SaveDeviceStateToFile("device1.xml");
         }
     }
 }