Ejemplo n.º 1
0
        /// <summary>
        /// Open detected local camera.
        /// </summary>
        private void OpenCamera2()
        {
            // Show camera selection form.
            CameraSelector cameraSelection = new CameraSelector();

            if (cameraSelection.ShowDialog(this) == DialogResult.OK)
            {
                // Create video source from selected camera.
                VideoCaptureDevice theCamera = new VideoCaptureDevice(cameraSelection.SelectedCamera);
                // Close previous video source.
                CameraView2.SignalToStop();
                CameraView2.WaitForStop();
                // Choose video resolution.
                theCamera.VideoResolution = theCamera.VideoCapabilities[cameraSelection.SelectedOption];
                // Set the new video source.
                CameraView2.VideoSource = theCamera;
                CameraView2.Start();
                OptionsControl.ShowDialog();
                CameraReady = true;
            }
        }
Ejemplo n.º 2
0
        // ==========================================================================
        // ==========================================================================
        // AFORGE.NET RELATED AND IMAGE PROCESSING FUNCTIONS

        /// <summary>
        /// Open detected local camera.
        /// </summary>
        private void OpenCamera1()
        {
            // Show camera selection form.
            CameraSelector cameraSelection = new CameraSelector();

            if (cameraSelection.ShowDialog(this) == DialogResult.OK)
            {
                // Create video source from selected camera.
                VideoCaptureDevice theCamera = new VideoCaptureDevice(cameraSelection.SelectedCamera);
                // Close previous video source.
                CameraView1.SignalToStop();
                CameraView1.WaitForStop();
                // Choose video resolution.
                theCamera.VideoResolution = theCamera.VideoCapabilities[cameraSelection.SelectedOption];
                Wdth = theCamera.VideoResolution.FrameSize.Width;
                Hght = theCamera.VideoResolution.FrameSize.Height;
                // Set the new video source.
                CameraView1.VideoSource = theCamera;
                CameraView1.Start();
            }
        }