Ejemplo n.º 1
0
        private void FaceRecognition_Load(object sender, EventArgs e)
        {
            if (!StaticMethods.CheckOnlineStatus())
            {
                AppIsOnline = false;
                MessageBox.Show("Seems you are not online,data won't be sent to the cloud!", "Application Offline", MessageBoxButtons.OK);
            }
            InitializeRecognizedFaces();
            var devices     = new List <DsDevice>(DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice));
            var cameraNames = new List <string>();
            int camera      = 1;

            //  StartCapturing(1);
            foreach (var device in devices)
            {
                if (camera != 2)
                {
                    cameraNames.Add(device.Name);
                    tableLayoutPanel1.Controls.Add(new ImageBox()
                    {
                        Name = device.Name.Replace(" ", "_"), Height = 460, Width = 638
                    }, 1, tableLayoutPanel1.RowCount - 1);
                    var cameraParameters = new CameraParameters();
                    cameraParameters.CameraName = device.Name;
                    cameraParameters.grabber    = new Capture(camera - 1);
                    cameraParameters.grabber.QueryFrame();
                    Application.Idle += new EventHandler((s, ev) => FrameGrabber(s, ev, cameraParameters));
                }

                camera++;
            }
        }