Beispiel #1
0
 private void ImageUpdate()
 {
     MyInvoke.setToZero(ref mat);
     //mat.SetTo(new byte[600 * 600 * 3]);
     MyInvoke.AddLayer(mat, mat_layer_drag);
     demoTask?.drawObjectOn(mat, objectLayerKey);
     image1.Source = MyInvoke.MatToBitmap(mat); //BitmapSourceConvert.ToBitmapSource(mat);
 }
Beispiel #2
0
        private void Button_startRecord_Click(object sender, RoutedEventArgs e)
        {
            if (CheckBox_wantTrans.IsChecked == false)
            {
                MessageBox.Show("請使用世界座標系");
                return;
            }
            if (dripTrayPos == null)
            {
                MessageBox.Show("請設定Drip Tray位置");
                return;
            }
            evil_toggleOnce     = false;
            cir_toggleOnce.Fill = new SolidColorBrush(Colors.Gray);
            evil_pouCount       = 0;
            if (evil_pourMax == 1)
            {
                cir_pourOnce1.Fill = new SolidColorBrush(Colors.Transparent);
                cir_pourOnce2.Fill = new SolidColorBrush(Colors.Black);
            }
            else if (evil_pourMax == 2)
            {
                cir_pourOnce1.Fill = new SolidColorBrush(Colors.Transparent);
                cir_pourOnce2.Fill = new SolidColorBrush(Colors.Transparent);
            }

            handing = new Objects();
            LV_actionBase.Items.Clear();
            MyInvoke.setToZero(ref mat_cup);
            timeTick = 0;

            ActionList.Clear();
            Rect_actionBaseTopColor.Fill = new SolidColorBrush(Color.FromArgb(200, 40, 210, 40));
            startDemo = true;

            cir_CreatAction.Fill = Color_UnSet;
        }
Beispiel #3
0
        private void imageBox3_Click(object sender, EventArgs e)
        {
            string[] file = File.ReadAllLines($"Act\\{videoIndex}_act_output.txt");
            Mat mat = new Mat(150, file.Count(), DepthType.Cv8U, 3);
            MyInvoke.setToZero(ref mat);
            for (int i = 0; i < file.Count(); i++)
            {
                int act = int.Parse(file[i].Split('\t')[1]);
                if (act == 0)//PP              
                    CvInvoke.Line(mat, new Point(10 + i, 25), new Point(10 + i, 75), new MCvScalar(200, 50, 50));
                else if (act == 1)//switch
                    CvInvoke.Line(mat, new Point(10 + i, 25), new Point(10 + i, 75), new MCvScalar(50, 200, 50));
                else if (act == 2)//pour
                    CvInvoke.Line(mat, new Point(10 + i, 25), new Point(10 + i, 75), new MCvScalar(50, 50, 200));
            }

            file = File.ReadAllLines($"Act\\10_act_obj.txt");
            for (int i = 0; i < file.Count(); i++)
            {
                string bCup = file[i].Split('\t')[1];
                string pCup = file[i].Split('\t')[2];
                if (bCup == "M")
                    CvInvoke.Line(mat, new Point(10 + i, 85), new Point(10 + i, 105), new MCvScalar(50, 200, 200));
                else if (bCup == "B") { }
                else
                    CvInvoke.Line(mat, new Point(10 + i, 85), new Point(10 + i, 105), new MCvScalar(100, 100, 100));

                if (pCup == "M")
                    CvInvoke.Line(mat, new Point(10 + i, 110), new Point(10 + i, 130), new MCvScalar(50, 200, 200));
                else if (pCup == "B") { }
                else
                    CvInvoke.Line(mat, new Point(10 + i, 110), new Point(10 + i, 130), new MCvScalar(100, 100, 100));
            }

            imageBox3.Image = mat;
        }
Beispiel #4
0
 private void ClearBoard()
 {
     MyInvoke.setToZero(ref mat);
     MyInvoke.setToZero(ref mat_layer_drag);
     ImageUpdate();
 }