Example #1
0
 // Constructor
 public Grabber(CaptureDevice parent)
 {
     this.parent = parent;
 }
Example #2
0
 // Constructor
 public Grabber(CaptureDevice parent)
 {
     this.parent = parent;
 }
Example #3
0
        // Open local capture device
        private void openLocalFileItem_Click( object sender, System.EventArgs e )
        {
            CaptureDeviceForm form = new CaptureDeviceForm( );

            if ( form.ShowDialog( this ) == DialogResult.OK )
            {
                // create video source
                CaptureDevice localSource = new CaptureDevice( );
                localSource.VideoSource = form.Device;

                // open it
                OpenVideoSource( localSource );
            }
        }
Example #4
0
        private void button22_Click(object sender, EventArgs e)
        {
            trackBar6.Enabled = false;
            CaptureDeviceForm form = new CaptureDeviceForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                // create video source
                CaptureDevice localSource = new CaptureDevice();
                localSource.VideoSource = form.Device;

                // open it
                OpenVideoSource(localSource);
            }
        }
Example #5
0
 //webcam voor de kleine zijde laden
 public bool WebcamVoorKleineZijdeLaden(CaptureDevice webcam, TCPOut socket)
 {
     try { kleineZijde = new ShortSide(webcam, socket.IpAddres, socket.Poort);
         return true; }
     catch { return false; }
 }
Example #6
0
        //webcam laden en achergrond laden
        public bool WebcamLadenEnAchtergrondBepalen(CaptureDevice webcamLinks, CaptureDevice webcamRechts, CaptureDevice webcamMidden)
        {
            try
            {
                //linkerwebcam
                videoL = new VideoInput(webcamLinks, frames, pixels, verBack);
                while (!videoL.BackgroundFound) { }
                imageLinks = videoL.backGround;
                imageLinks.Save("c://achtergrond_links.bmp");
                Console.WriteLine("  Achtergrond gevonden van linkerwebcam,");
                Console.WriteLine("   afbeelding opgeslagen in c://achtergrond_links.bmp");
                //middenwebcam
                videoM = new VideoInput(webcamMidden, frames, pixels, verBack);
                while (!videoM.BackgroundFound) { }
                imageMidden = videoM.backGround;
                imageMidden.Save("c://achtergrond_midden.bmp");
                Console.WriteLine("  Achtergrond gevonden van middenwebcam,");
                Console.WriteLine("   afbeelding opgeslagen in c://achtergrond_midden.bmp");
                //rechterwebcam
                videoR = new VideoInput(webcamRechts, frames, pixels, verBack);
                while (!videoR.BackgroundFound) { }
                imageRechts = videoR.backGround;
                imageRechts.Save("c://achtergrond_rechts.bmp");
                Console.WriteLine("  Achtergrond gevonden van rechterwebcam,");
                Console.WriteLine("   afbeelding opgeslagen in c://achtergrond_rechts.bmp");

                //hoogte van image bepalen
                height = imageMidden.Height;
                return true;
            }
            catch { return false; }
        }
        public CameraWindow OpenVideoSource(int deviceIndex)
        {
            try
            {
                this.device = filters[deviceIndex].MonikerString;
                CaptureDevice localSource = new CaptureDevice();
                localSource.VideoSource = device;

                //close previous file
                CloseFile();

                // create camera
                VideoCamera camera = new VideoCamera(localSource);

                // Start camera
                camera.Start();

                // attach camera to camera window
                cameraWindow.Camera = camera;

                // set event handlers
                camera.NewFrame += new EventHandler(camera_NewFrame);
            }
            catch (Exception e)
            {
                return null;
            }

            return cameraWindow;
        }