private void StartVideoCapture()
        {
            StartToolStripMenuItem.Enabled = false;
            StopToolStripMenuItem.Enabled  = true;

            VideoCaptureCancellationTokenSource = new CancellationTokenSource();

            var webCamDevices = WebCamClient.FindDevices();
            var webCamFormats = WebCamClient.GetVideoFormat(0);

            VideoCapture = new WebCamClient(0, webCamFormats[0]);
            VideoCapture.Start();

            Task.Run(() => CaptureCamera(VideoCaptureCancellationTokenSource.Token), VideoCaptureCancellationTokenSource.Token);
        }
Example #2
0
        private void StartCaptureButton_Click(object sender, EventArgs e)
        {
            StopCaptureButton.Enabled      = true;
            AddImageButton.Enabled         = true;
            StartCaptureButton.Enabled     = false;
            UserImagesDataGridView.Enabled = false;

            VideoCaptureCancellationTokenSource = new CancellationTokenSource();

            var webCamDevices = WebCamClient.FindDevices();
            var webCamFormats = WebCamClient.GetVideoFormat(0);

            VideoCapture = new WebCamClient(0, webCamFormats[0]);
            VideoCapture.Start();

            Task.Run(() => GetVideoCaptureFrames(VideoCaptureCancellationTokenSource.Token), VideoCaptureCancellationTokenSource.Token);
        }