//private SaveFileDialog saveAvi;

        private void Form1_Load(object sender, EventArgs e)
        {
            /*
             * Tạo thời digital timer và set up thời gian là +1s 1 lần
             */
            //t = new System.Timers.Timer();
            //t.Interval = 1000;
            //t.Elapsed += T_Elapsed;

            /*
             * End CounDown Timer
             */
            this.StartPosition = FormStartPosition.CenterScreen;                       // nằm giữa màn hình

            CaptureDevice = new FilterInfoCollection(FilterCategory.VideoInputDevice); //lọc ra những thiết bị camera hiện có

            foreach (FilterInfo Device in CaptureDevice)
            {
                cbNameDivice.Items.Add(Device.Name); // thêm vào cb những camera được kết nối
            }
            cbNameDivice.SelectedIndex = 0;          // chọn camera đầu tiên

            FinalFrame = new VideoCaptureDevice();

            captureDevice = new VideoCaptureDeviceForm();

            FileWriter = new VideoFileWriter();

            // Check btnCapture and btnRecord
            if (string.IsNullOrEmpty(txtPatientID.Text))
            {
                button1.Enabled = false;
            }
            txtPatientID.TextChanged += txtPatientID_TextChanged;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //Form para buscar dispositivos, para usar en vez del FilterInfoCollection
            VideoCaptureDeviceForm formvideo = new VideoCaptureDeviceForm();

            formvideo.ShowDialog();
        }
示例#3
0
        byte[] image_array; //array is sending in network
        #endregion


        /// <summary>
        /// Connect/disconnect with camera
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button_connect_camera_Click(object sender, EventArgs e)
        {
            if (flag_connect_camera)
            {
                if (!(videoSourse == null))
                {
                    if (videoSourse.IsRunning)
                    {
                        videoSourse.SignalToStop();
                        videoSourse = null;
                    }
                }

                flag_connect_camera            = false;
                button_connect_camera.Text     = "Connect";
                radioButton_date_image.Enabled = true;
                radioButton_date_point.Enabled = true;
            }
            else
            {
                VideoCaptureDeviceForm vcdForm = new VideoCaptureDeviceForm();
                if (vcdForm.ShowDialog() == DialogResult.OK)
                {
                    videoSourse = vcdForm.VideoDevice;
                }
                videoSourse.NewFrame += new NewFrameEventHandler(video_NewFrame);
                videoSourse.Start();

                flag_connect_camera            = true;
                button_connect_camera.Text     = "Disconnect";
                radioButton_date_image.Enabled = false;
                radioButton_date_point.Enabled = false;
            }
        }
示例#4
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm videoSettings = new VideoCaptureDeviceForm();
            var result = videoSettings.ShowDialog(this);

            if (result == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            // create video source
            videoSource = videoSettings.VideoDevice;
            // set NewFrame event handler
            videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
            // start the video source
            videoSource.Start();


            var      fileName = string.Format(@"C:\temp\capv\{0}.flv", Guid.NewGuid().ToString());
            FileInfo fInfo    = new FileInfo(fileName);

            if (!Directory.Exists(fInfo.DirectoryName))
            {
                Directory.CreateDirectory(fInfo.DirectoryName);
            }

            // create new video file
            writer.Open(fileName, 640, 480, 30, VideoCodec.FLV1);

            //start a timer to sync the video timeline
            timer = System.Diagnostics.Stopwatch.StartNew();

            ShowCurrentStatus("running");
        }
        private void btnCamChange_Click(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                // create video source
                videoSource = form.VideoDevice;
                // open it
                OpenVideoSource(videoSource);
                //discover selected device
                FilterInfoCollection allDevices    = new FilterInfoCollection(FilterCategory.VideoInputDevice);
                VideoCaptureDevice   currentDevice = form.VideoDevice;
                for (int i = 0; i <= allDevices.Count; i++)
                {
                    if (allDevices[i].MonikerString == form.VideoDeviceMoniker)
                    {
                        txtCam.Text        = allDevices[i].Name; //.Substring(0, 25);
                        txtResolution.Text = videoSource.VideoResolution.FrameSize.Width + "x"
                                             + videoSource.VideoResolution.FrameSize.Height + " - "
                                             + videoSource.VideoResolution.AverageFrameRate + " fps";
                        break;
                    }
                }
            }
        }
示例#6
0
 private void Form1_Load(object sender, EventArgs e)
 {
     VideoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
     captureDevice       = new VideoCaptureDeviceForm();
     //Process.Start("https://javisystems.keka.com/ui/#/me/attendance/logs");
     ServerObject = new Server(this);
 }
示例#7
0
        private void button1_Click(object sender, EventArgs e)
        {
            //if (Finalvideo.IsRunning)
            //{
            //    Finalvideo.SignalToStop();
            //    Finalvideo.WaitForStop();

            //}
            // System.Threading.Thread.Sleep(100);
            VideoCaptureDeviceForm videoCaptureDeviceForm = new VideoCaptureDeviceForm();
            string videoDeviceMoniker = "";

            if (videoCaptureDeviceForm.ShowDialog() == DialogResult.OK)
            {
                videoCaptureDeviceForm.VideoDevice.DisplayPropertyPage((IntPtr)0);
                videoDeviceMoniker = videoCaptureDeviceForm.VideoDeviceMoniker;
                VideoCaptureDevice videoCaptureDevice = new VideoCaptureDevice(videoDeviceMoniker);
                // Hcls.WriteToConfig(FilePath, 1, videoDeviceMoniker);
                // LoadCamera(videoDeviceMoniker);
            }



            Finalvideo           = new VideoCaptureDevice(videoDeviceMoniker);
            Finalvideo.NewFrame += new NewFrameEventHandler(Finalvideo_NewFrame);
            //  Finalvideo.DesiredFrameRate = 20;//how many images you want in seconds. FPS
            // Finalvideo.DesiredFrameSize = new Size(320, 240);//image dimensions
            Finalvideo.Start();
        }
示例#8
0
        public Aforge()
        {
            InitializeComponent();
            AForge.Video.DirectShow.FilterInfoCollection videoDevices = new AForge.Video.DirectShow.FilterInfoCollection(FilterCategory.VideoInputDevice);



            captureDevice = new VideoCaptureDeviceForm();

            FinalVideo           = new VideoCaptureDevice(videoDevices[0].MonikerString);
            FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame);
            FinalVideo.Start();


            string baseAddress = "http://localhost:9000/";

            // Start OWIN host
            WebApp.Start <Startup>(url: baseAddress);
            Console.WriteLine("Streaming start...");
            Console.ReadLine();



            // Start OWIN host
            // WebApp.Start<owin_Classes.Startup1>(url: baseAddress);
            // WebApp.Start<owin_Classes.Startup1>("http://*:8511");
            //Console.WriteLine("Streaming start...");
            //Console.ReadLine();


            // Start OWIN host
            //WebApp.Start<Startup>(url: baseAddress);
            //Console.WriteLine("Streaming start...");
            //Console.ReadLine();



            //MyUser myUser = new MyUser();
            //myUser.Id = 1;
            //myUser.Name = "AutomatedUITestUser";

            //var fakeHttpSessionState =
            //                     new FakeHttpSessionState(new SessionStateItemCollection());
            //fakeHttpSessionState.Add("__CurrentUser__", myUser);

            //mockControllerContext = Mock.Of<ControllerContext>(ctx =>
            //ctx.HttpContext.User.Identity.Name == myUser.Name &&
            //ctx.HttpContext.User.Identity.IsAuthenticated == true &&
            //ctx.HttpContext.Session == fakeHttpSessionState &&
            //ctx.HttpContext.Request.AcceptTypes ==
            //               new string[] { "MyFormsAuthentication" } &&
            //ctx.HttpContext.Request.IsAuthenticated == true &&
            //ctx.HttpContext.Request.Url == new Uri("http://127.0.0.1") &&
            //ctx.HttpContext.Response.ContentType == "video"
            //);
        }
示例#9
0
        public static VideoCaptureDevice StartVideoSource()
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                videoSource1 = form.VideoDevice;
            }
            return(videoSource1);
        }
示例#10
0
        private void LocalVideoCaptureDeviceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var form = new VideoCaptureDeviceForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                VideoCaptureDevice videoSource = form.VideoDevice;
                OpenVideoSource(videoSource);
            }
        }
示例#11
0
 private void Form1_Load(object sender, EventArgs e)
 {
     VideoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
     foreach (FilterInfo device in VideoCaptureDevices)
     {
         comboBox1.Items.Add(device);
     }
     captureDevice           = new VideoCaptureDeviceForm();
     comboBox1.SelectedIndex = 0;
 }
示例#12
0
 private void cameraSettingButton_Click(object sender, EventArgs e)
 {
     using (var form = new VideoCaptureDeviceForm())
     {
         if (form.ShowDialog() == DialogResult.OK)
         {
             settings.CameraId       = form.VideoDeviceMoniker;
             settings.VideoFrameSize = form.VideoDevice.VideoResolution.FrameSize;
         }
     }
 }
示例#13
0
        private void OpenVideo(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                // create video source
                VideoCaptureDevice videoSource = form.VideoDevice;
                OpenVideoSource(videoSource);
            }
        }
示例#14
0
        private void RequestVideoSource()
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                videoStreaming.StartVideoSource(form.VideoDevice,
                                                form.VideoDevice.VideoResolution.FrameSize.Width,
                                                form.VideoDevice.VideoResolution.FrameSize.Height);
            }
        }
        private void recordVideoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm captureDevice = new VideoCaptureDeviceForm();

            if (captureDevice.ShowDialog(this) == DialogResult.OK)
            {
                videoSource           = captureDevice.VideoDevice;
                videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
                videoSource.Start();
            }
        }
示例#16
0
    private void remoteAimToolStripMenuItem_Click(object sender, EventArgs e)
    {
      AllOffButton_Click(sender, e);

      VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

      if (form.ShowDialog(this) == DialogResult.OK)
      {
        RemoteAim ra = new RemoteAim(form.VideoDevice);
        ra.Show();
      }
    }
示例#17
0
    private void fPSToolStripMenuItem_Click(object sender, EventArgs e)
    {
        AllOffButton_Click(sender, e);

        VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

        if (form.ShowDialog(this) == DialogResult.OK)
        {
            FPSAim fps = new FPSAim(form.VideoDevice);
            fps.Show();
        }
    }
示例#18
0
        private void btnInicio_Click(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm webcamform = new VideoCaptureDeviceForm();

            webcamform.ShowDialog();
            VideoCaptureDevice webcam = new VideoCaptureDevice(webcamform.VideoDeviceMoniker);

            webcam.NewFrame += new NewFrameEventHandler(Grabar);
            webcam.Start();
            this.vspWebcam.VideoSource = webcam;
            vspWebcam.Start();
        }
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            resetUI();
            VideoCaptureDeviceForm captureDevice = new VideoCaptureDeviceForm();

            if (captureDevice.ShowDialog(this) == DialogResult.OK)
            {
                videoSource           = captureDevice.VideoDevice;
                videoSource.NewFrame += new NewFrameEventHandler(video_NewFrame);
                videoSource.Start();
            }
        }
示例#20
0
文件: Form2.cs 项目: kanulp/eduboard
 private void Form2_Load(object sender, EventArgs e)
 {
     try
     {
         VideoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
         captureDevice       = new VideoCaptureDeviceForm();
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.ToString());
     }
 }
示例#21
0
        private void ButtonKameraAktif_Click(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                // create video source
                VideoCaptureDevice videoSource = form.VideoDevice;

                // open it
                OpenVideoSource(videoSource);
            }
        }
示例#22
0
        // Open local video capture device
        private void localVideoCaptureDeviceToolStripMenuItem_Click( object sender, EventArgs e )
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm( );

            if ( form.ShowDialog( this ) == DialogResult.OK )
            {
                // create video source
                VideoCaptureDevice videoSource = form.VideoDevice;

                // open it
                OpenVideoSource( videoSource );
            }
        }
示例#23
0
        private void btnOpenVideo_Click(object sender, EventArgs e)
        {
            pictureBox1.Visible       = false;
            videoSourcePlayer.Visible = true;
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                // create video source
                VideoCaptureDevice videoSource = form.VideoDevice;
                // open it
                OpenVideoSource(videoSource);
            }
        }
示例#24
0
        private void button_ChangeVideoSource_Click(object sender, RoutedEventArgs e)
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                videoSource = form.VideoDevice;
                glyphRecogniser.InjectVideoSource(videoSource);
            }
            else
            {
                Console.WriteLine("Couldn't open video source");
            }
        }
示例#25
0
        private void OpenDeviceButton_Click(object sender, EventArgs e)
        {
            StopDevice();

            using (VideoCaptureDeviceForm deviceSelectorForm = new VideoCaptureDeviceForm())
            {
                if (deviceSelectorForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    VideoCaptureDevice device = deviceSelectorForm.VideoDevice;

                    StartDevice(device);
                }
            }
        }
示例#26
0
        public void SelectVideoSource()
        {
            VideoCaptureDeviceForm form = null;

            if (videoSourcePlayer.VideoSource == null)
            {
                form = new VideoCaptureDeviceForm();

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    OpenVideoSource(form.VideoDevice);
                }
            }
        }
        private void takeVideo()
        {
            //make a messagebox saying video will start in 20 seconds for training
            MessageBox.Show("You have to make a gesture. Once done, 12 images extracted from your video will be shown. Click on the image which is good enough and enter the letter you signed for.");
            //start taking video and pick 12 images
            VideoCaptureDeviceForm captureDevice = new VideoCaptureDeviceForm();

            if (captureDevice.ShowDialog(this) == DialogResult.OK)
            {
                videoSource           = captureDevice.VideoDevice;
                videoSource.NewFrame += new NewFrameEventHandler(video_NewFrameTraining);
                videoSource.Start();
            }
        }
示例#28
0
        //カメラ起動ボタンを押下
        private void Start_Camera_Click(object sender, EventArgs e)
        {
            var form = new VideoCaptureDeviceForm();

            // 選択ダイアログを開く
            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // 選択されたデバイスをVideoSourcePlayerのソースに設定
                videoSourcePlayer1.VideoSource = form.VideoDevice;
                //Webカメラ起動でシャッターボタンを有効に
                button_chapture.Enabled = true;
                // ビデオキャプチャのスタート
                videoSourcePlayer1.Start();
            }
        }
        private void btnStart_Click(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm videoCaptureDeviceForm = new VideoCaptureDeviceForm();

            if (videoCaptureDeviceForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                videoCaptureDevice           = videoCaptureDeviceForm.VideoDevice;
                videoCaptureDevice.NewFrame += new NewFrameEventHandler(Captured);
                videoCaptureDevice.Start();
                Button1.Hide();
                btnCaptured.Show();
                btnSaveImage.Show();
                btnStart.Hide();
            }
        }
示例#30
0
        private void BtnStart_Click(object sender, EventArgs e)
        {
            fileName = "Channel" + "_" + DateTime.Now.Ticks.ToString() + Constants.EXTENSION_JPEG;

            VideoCaptureDeviceForm captureDeviceForm = new VideoCaptureDeviceForm();

            if (captureDeviceForm.ShowDialog(this) == DialogResult.OK)
            {
                videoSource      = captureDeviceForm.VideoDevice;
                asyncVideoSource = new AsyncVideoSource(videoSource);

                asyncVideoSource.NewFrame += AsyncVideoSource_NewFrame;
                asyncVideoSource.Start();
            }
        }
示例#31
0
        private void 本地摄像头ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.flowLayoutPanelVlc.Visible    = false;
            this.flowLayoutPanelNormal.Visible = true;
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                // create video source
                VideoCaptureDevice videoSource = form.VideoDevice;

                // open it
                OpenVideoSource(videoSource);
            }
        }
示例#32
0
        private void btnSelectCamera_Click(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                VideoCaptureDevice device = new VideoCaptureDevice(form.VideoDevice);

                device.VideoResolution = selectResolution(device);

                controller.Device = device;
                controller.Start();

                toolStripStatusLabel1.Text = "Initializing...";
            }
        }
示例#33
0
        private void fPSToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AllOffButton_Click(sender, e);

            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
            FPSAim fps = new FPSAim(form.VideoDevice);
            fps.Show();
            }
        }
示例#34
0
        private void remoteAimToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AllOffButton_Click(sender, e);

              VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

              if (form.ShowDialog(this) == DialogResult.OK)
              {
            RemoteAim ra = new RemoteAim(form.VideoDevice);
            ra.Show();
              }
        }
示例#35
0
        // Open local video capture device
        private void localVideoCaptureDeviceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                // create video source
                VideoCaptureDevice videoSource = new VideoCaptureDevice(form.VideoDevice);

                // set frame size
                videoSource.DesiredFrameSize = new Size(320, 240);

                // open it
                OpenVideoSource(videoSource);
            }
        }
示例#36
0
        private void btnSelectCamera_Click(object sender, EventArgs e)
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                int deviceId = form.DeviceId;

                kinectDevice = Kinect.GetDevice(deviceId);

                if (videoCamera == null)
                {
                    videoCamera = kinectDevice.GetVideoCamera();
                    videoCamera.CameraMode = VideoCameraMode.Color;
                    videoCamera.NewFrame += new AForge.Video.NewFrameEventHandler(videoCamera_NewFrame);
                    videoCamera.Start();
                }

                if (depthCamera == null)
                {
                    depthCamera = new KinectDepthCamera(deviceId, CameraResolution.Medium,
                        provideOriginalDepthImage: true);

                    videoSourcePlayer1.VideoSource = depthCamera;
                    videoSourcePlayer1.Start();
                }

                toolStripStatusLabel1.Text = "Initializing...";
            }
        }
示例#37
0
        private void CameraFeedOn()
        {
            VideoCaptureDeviceForm form = new VideoCaptureDeviceForm();

              if (form.ShowDialog(this) == DialogResult.OK)
              {
            // create video source
            //VideoCaptureDevice videoSource = new VideoCaptureDevice(form.VideoDevice, false);
            VideoCaptureDevice videoSource = new VideoCaptureDevice(form.VideoDevice, new Size(320, 240), true);

            // open it
            OpenVideoSource(videoSource);
            CameraFeedButton.Text = "ON";
            CameraFeedButton.BackColor = Color.Green;
            MotionDetectionButton.Enabled = true;
              }
        }