Beispiel #1
0
        public FormMain()
        {
            InitializeComponent();

            _qz2018 = new Quiz2018();
            _qz2018.Init(this);

            cbTRFFaces.Items.AddRange(_qz2018.GetNames());
            cbTFFaces.Items.AddRange(_qz2018.GetNames());
            cbTFFaces.Items.Add("ALL");

            cbTGGroups.Items.AddRange(_qz2018.GetGroups());

            cbQNbr.Items.AddRange(_qz2018.GetQuestions());
            cbQGrp.Items.AddRange(_qz2018.GetGroups());



            FaceRecognition = new EigenFaceRecognizer(80, double.PositiveInfinity);
            FaceDetection   = new CascadeClassifier(System.IO.Path.GetFullPath(@"../../Algo/haarcascade_frontalface_default.xml"));
            Frame           = new Mat();
            Faces           = new List <Image <Gray, byte> >();
            Ids             = new List <int>();
            Names           = new List <string>();

            //BeginWebcam();
        }
        public void FormInit(Quiz2018 qz)
        {
            try
            {
                _qz = qz;

                CameraFeed = new Mat();
                HSV        = new Mat();

                Bmin = _qz.QSet.Shapes[0].InRange.Bmin;
                Bmax = _qz.QSet.Shapes[0].InRange.Bmax;
                Gmin = _qz.QSet.Shapes[0].InRange.Gmin;
                Gmax = _qz.QSet.Shapes[0].InRange.Gmax;
                Rmin = _qz.QSet.Shapes[0].InRange.Rmin;
                Rmax = _qz.QSet.Shapes[0].InRange.Rmax;

                trackBarHmin.Value = Bmin;
                trackBarHmax.Value = Bmax;
                trackBarSmin.Value = Gmin;
                trackBarSmax.Value = Gmax;
                trackBarVmin.Value = Rmin;
                trackBarVmax.Value = Rmax;

                trackBarGCTH1.Value = 3;
                trackBarGCTH2.Value = 43;

                Smooth = _qz.QSet.Shapes[0].SmoothGaussian.kernelSize;
                trackBarSmooth.Value = Smooth;

                CannyThreshold1 = _qz.QSet.Shapes[0].Canny.Threshold1;
                trackBarCannyThreshold1.Value = (int)CannyThreshold1;
                CannyThreshold2 = _qz.QSet.Shapes[0].Canny.Threshold2;
                trackBarCannyThreshold2.Value = (int)CannyThreshold2;
                CannyL2Gradient   = _qz.QSet.Shapes[0].Canny.L2gradient;
                CannyApertureSize = _qz.QSet.Shapes[0].Canny.ApertureSize;
                trackBarCannyApertureSize.Value = CannyApertureSize;


                TEST1 = new Image <Bgr, byte>(System.IO.Path.GetFullPath($@"../../Images/circle.png"));


                //1920 x 1080
                //1600 x 900
                //1366 x 768
                //1280 x 720
                //1024 x 57

                Capture = new VideoCapture(0 + Emgu.CV.CvEnum.CaptureType.DShow);
                Capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FourCC, VideoWriter.Fourcc('M', 'J', 'P', 'G'));
                Capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameWidth, 300);   //1920.0
                Capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameHeight, 300);  //1080.0
                Capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.Settings, 1);
                //Capture.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.Backlight, 0);
                Capture.ImageGrabbed += Capture_ImageGrabbed;
                Capture.Start();
            }
            catch (Exception)
            {
            }
        }
 public void Init(Quiz2018 qz)
 {
     _qz = qz;
 }