private void TestLabelSpace(object sender, RoutedEventArgs e)
        {
            x  = (int)slider_x.Value;
            y  = (int)slider_y.Value;
            w  = (int)slider_w.Value;
            h  = (int)slider_h.Value;
            s1 = (int)slider_s1.Value;
            s2 = (int)slider_s2.Value;

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

            labelspace.Content = "测试结果:" + space[0] + "," + space[1];
            img = img.CvtColor(ColorConversionCodes.BGR2GRAY);
            var img1 = img.Threshold(s1, 255, ThresholdTypes.Binary);
            var img2 = img.Threshold(s2, 255, ThresholdTypes.Binary);

            camera1.Source = Tools.OpenCvImgToImageSoure(img1);
            camera2.Source = Tools.OpenCvImgToImageSoure(img2);

            bloodparameter.label_x  = x;
            bloodparameter.label_y  = y;
            bloodparameter.label_w  = w;
            bloodparameter.label_h  = h;
            bloodparameter.label_s1 = s1;
            bloodparameter.label_s2 = s2;
            bloodparameter.Save();
        }
示例#2
0
        private void UpDataUI(object sender, EventArgs e)
        {
            selector_red   = setvaluered.Value;
            selector_blue  = setvalueblue.Value;
            selector_green = setvaluegreen.Value;
            selector_gain  = setvaluegain.Value;

            label_setvaluegain.Content  = selector_gain;
            label_setvaluered.Content   = selector_red;
            label_setvalueblue.Content  = selector_blue;
            label_setvaluegreen.Content = selector_green;


            camera.SetBalanceRatio(BalanceWhiteChanelEnum.BALANCE_RATIO_SELECTOR_RED, selector_red);
            camera.SetBalanceRatio(BalanceWhiteChanelEnum.BALANCE_RATIO_SELECTOR_BLUE, selector_green);
            camera.SetBalanceRatio(BalanceWhiteChanelEnum.BALANCE_RATIO_SELECTOR_GREEN, selector_blue);
            camera.SetGain(selector_gain);
            camera.TakeImage(bloodparameter.onedcode_s3);
            camera1.Source = camera.GetImageSoure();
        }
示例#3
0
        private void TestOneDCode(object sender, RoutedEventArgs e)
        {
            var img = camera.TakeImage(s3);

            camera2.Source = Tools.OpenCvImgToImageSoure(img);
            camera3.Source = Tools.OpenCvImgToImageSoure(img);
            var code = Tools.GetOneDCode(img, x, y, w, h, s1, s2);

            camera1.Source     = Tools.OpenCvImgToImageSoure(code.full_img);
            labelspace.Content = "测试结果:" + code.code;

            bloodparameter.onedcode_x  = x;
            bloodparameter.onedcode_y  = y;
            bloodparameter.onedcode_w  = w;
            bloodparameter.onedcode_h  = h;
            bloodparameter.onedcode_s1 = s1;
            bloodparameter.onedcode_s2 = s2;
            bloodparameter.onedcode_s3 = s3;
            bloodparameter.tube_y      = tubey;
            bloodparameter.Save();
        }
        private void TestOrcNumber(object sender, RoutedEventArgs e)
        {
            var img = camera.TakeImage(bloodparameter.onedcode_s3);

            if (img == null)
            {
                return;
            }
            var orcnumber = Tools.GetOrcNumber(img, x, y, w, h, s1, bloodparameter.onedcode_s2, bloodparameter.ID);

            camera1.Source          = Tools.OpenCvImgToImageSoure(img);
            camera2.Source          = Tools.OpenCvImgToImageSoure(orcnumber.full_img);
            camera3.Source          = Tools.OpenCvImgToImageSoure(orcnumber.number_img);
            labelretnumbers.Content = orcnumber.numberstr;


            bloodparameter.orcnumber_x  = x;
            bloodparameter.orcnumber_y  = y;
            bloodparameter.orcnumber_w  = w;
            bloodparameter.orcnumber_h  = h;
            bloodparameter.orcnumber_s1 = s1;
            bloodparameter.Save();
        }
        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();
        }