Beispiel #1
0
 private void Run(WebCameraControl wc, PictureBox pb1, PictureBox pb2)
 {
     while(true)
     {
         myEvent(wc, pb1, pb2);
     }
 }
Beispiel #2
0
        //public void Capturing()
        //{
        //    Image img = webCameraControl1.GetCurrentImage();
        //    pbCapture1.Image = img;
        //    Thread.Sleep(1000);
        //    Image img2 = webCameraControl1.GetCurrentImage();
        //    pbCapture2.Image = img2;
        //}
        private void myEvent(WebCameraControl wc, PictureBox pb1, PictureBox pb2)
        {

            Image img = wc.GetCurrentImage();
      
            pb1.Image = img;
            Thread.Sleep(500);
            Compare(pb1, pb2);


            Thread.Sleep(2000);

            Image img2 = wc.GetCurrentImage();
            pb2.Image = img2;
            Thread.Sleep(500);
            Compare(pb1, pb2);

            Thread.Sleep(2000);
            //if (count == 0)
            //{
            //    count++;
            //    firstPB = false;
            //    Image img = webCameraControl1.GetCurrentImage();
            //    pbCapture1.Image = img;
            //}
            //else
            //{
            //    if (firstPB)
            //    {
            //        Image img = webCameraControl1.GetCurrentImage();
            //        pbCapture1.Image = img;
            //        firstPB = false;
            //        Compare();
            //    }
            //    //Thread.Sleep(1000);
            //    else
            //    {
            //        Image img2 = webCameraControl1.GetCurrentImage();
            //        pbCapture2.Image = img2;
            //        firstPB = true;
            //        Compare();
            //    }
        }
Beispiel #3
-1
 private Bitmap GetWebCamImage()
 {
     Bitmap image = null;
     var webCameraControl = new WebCameraControl();
     WebCameraId camera = null;
     foreach (WebCameraId c in webCameraControl.GetVideoCaptureDevices())
     {
         if (c != null)
         {
             camera = c;
             break;
         }
     }
     if (camera != null)
     {
         webCameraControl.StartCapture(camera);
         System.Threading.Thread.Sleep(2000);
         image = webCameraControl.GetCurrentImage();
         System.Threading.Thread.Sleep(250);
         webCameraControl.StopCapture();
     }
     return image;
 }