예제 #1
0
 public bool Init()
 {
     DhCamera.InitDhSdk();
     for (int i = 0; i < camera.Count(); i++)
     {
         camera[i] = new DhCamera(i);
         if (camera[i].Open() == false)
         {
             return(false);
         }
         camera[i].SetBalanceRatio(BalanceWhiteChanelEnum.BALANCE_RATIO_SELECTOR_RED, booldcardinfo[i].bloodParameter.camre_rb);
         camera[i].SetBalanceRatio(BalanceWhiteChanelEnum.BALANCE_RATIO_SELECTOR_BLUE, booldcardinfo[i].bloodParameter.camre_gb);
         camera[i].SetBalanceRatio(BalanceWhiteChanelEnum.BALANCE_RATIO_SELECTOR_GREEN, booldcardinfo[i].bloodParameter.camre_bb);
         camera[i].SetGain(booldcardinfo[i].bloodParameter.camre_gain);
         camera[i].SetExposureTime(booldcardinfo[i].bloodParameter.onedcode_s3);
         Unet[i] = PyTorchSDK.CreateModel(64, 128);
         PyTorchSDK.LoadModel(Unet[i], "model/unet_gpu.pt");
         Ocrnet[i] = PyTorchSDK.CreateModel(28, 28);
         PyTorchSDK.LoadModel(Ocrnet[i], "model/orc_gpu.pt");
     }
     SetTimplateImage("template.jpg");
     SetTimplateImage("icon.jpg");
     SetTimplateImage("a.jpg");
     SetTimplateImage("mask.jpg");
     return(true);
 }
 private void OnSelectCamera(object sender, SelectionChangedEventArgs e)
 {
     camera         = Tools.camera[camera_sel.SelectedIndex];
     bloodparameter = Tools.booldcardinfo[camera_sel.SelectedIndex].bloodParameter;
     OnLoaded(sender, e);
     //事件响应
 }
예제 #3
0
 public CameraSetting()
 {
     InitializeComponent();
     camera_sel.Items.Add("相机1");
     camera_sel.Items.Add("相机2");
     camera_sel.SelectedIndex = 0;
     camera         = Tools.camera[0];
     bloodparameter = Tools.booldcardinfo[0].bloodParameter;
     timer          = new DispatcherTimer();
     timer.Interval = TimeSpan.FromMilliseconds(500);
     timer.Tick    += UpDataUI;
     timer.Start();
     UpDataParameter();
 }
 public OrcNumberSetting()
 {
     InitializeComponent();
     camera_sel.Items.Add("相机1");
     camera_sel.Items.Add("相机2");
     camera_sel.SelectedIndex = 0;
     camera         = Tools.camera[0];
     bloodparameter = Tools.booldcardinfo[0].bloodParameter;
     camera1.Source = camera.GetImageSoure();
     //UI更新
     timer          = new DispatcherTimer();
     timer.Interval = TimeSpan.FromMilliseconds(100);
     timer.Tick    += UpDataUI;
     timer.Start();
     UpDataParameter();
 }
        public LabelSetting()
        {
            InitializeComponent();
            camera_sel.Items.Add("相机1");
            camera_sel.Items.Add("相机2");
            camera_sel.SelectedIndex = 0;
            camera          = Tools.camera[0];
            bloodparameter  = Tools.booldcardinfo[0].bloodParameter;
            camera1.Source  = camera.GetImageSoure();
            camera_ration_w = camera.camera_img.Width / camera1.Width;
            camera_ration_h = camera.camera_img.Height / camera1.Height;
            //UI更新
            timer          = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(100);
            timer.Tick    += UpDataUI;
            timer.Start();

            var img = camera.TakeImage(bloodparameter.onedcode_s3);

            camera1.Source = Tools.OpenCvImgToImageSoure(img);
            camera2.Source = Tools.OpenCvImgToImageSoure(img);

            UpDataParameter();
        }