Пример #1
0
        public void openWebcamWindow()
        {
            Dictionary <int, string> devices   = new Dictionary <int, string>();
            Dictionary <int, string> solutions = new Dictionary <int, string>();

            devices = model.get_devices();

            // Aufnahmegeräte verfügbar
            if (devices.Count > 0)
            {
                solutions = model.get_solution_modes();
                if (solutions.Count > 0)
                {
                    cam = new WebcamOptions(devices, solutions);
                    cam.Show();
                    // Aufnahmemöglichkeit aktivieren
                    capture_possible = true;
                }
                else
                {
                    MessageBox.Show("Kein Eingabegerät vorhanden.");
                }
            }
            else
            {
                MessageBox.Show("Kein Eingabegerät vorhanden.");
            }
        }
Пример #2
0
        public void show_picture(PictureBox pic, WebcamOptions form)
        {
            this.pic = pic;
            Dictionary <int, string> devices = this.get_devices();

            if (videosources.Count > this.device.Key && devices.Count > 1)
            {
                videoSource = new VideoCaptureDevice(videosources[this.get_device().Key].MonikerString);
                string solution = "0;0";
                solution = get_solution(videoSource).Value;

                //Dem Webcam Objekt ermittelte Auflösung übergeben
                videoSource.DesiredFrameSize = videoSource.VideoCapabilities[Convert.ToInt32(solution.Split(';')[1])].FrameSize;
                //pic.Size = new Size(videoSource.DesiredFrameSize.Width, videoSource.DesiredFrameSize.Height);
                //form.Size = new Size(videoSource.DesiredFrameSize.Width +100, videoSource.DesiredFrameSize.Height +100);
                pic.SizeMode = PictureBoxSizeMode.Zoom;
                //
                //NewFrame Eventhandler zuweisen anlegen.
                //(Dieser registriert jeden neuen Frame der Webcam)
                videoSource.NewFrame += new AForge.Video.NewFrameEventHandler(videoSource_NewFrame);
                //  videoSource.SnapshotFrame += new AForge.Video.NewFrameEventHandler(videoSource_NewFrame);
                //Das Aufnahmegerät aktivieren
                videoSource.Start();
            }
        }
        public void openWebcamWindow()
        {
            Dictionary<int, string> devices   = new Dictionary<int,string>();
            Dictionary<int, string> solutions = new Dictionary<int, string>();
            devices = model.get_devices();

            // Aufnahmegeräte verfügbar
            if (devices.Count > 0)
            {
                solutions = model.get_solution_modes();
                if (solutions.Count > 0)
                {
                    cam = new WebcamOptions(devices, solutions);
                    cam.Show();
                    // Aufnahmemöglichkeit aktivieren
                    capture_possible = true;
                }
                else
                {
                    MessageBox.Show("Kein Eingabegerät vorhanden.");
                }
            }
            else
            {
                MessageBox.Show("Kein Eingabegerät vorhanden.");
            }
        }
Пример #4
0
        public void show_picture( PictureBox pic, WebcamOptions form)
        {
            this.pic = pic;
            Dictionary<int, string> devices = this.get_devices();
            if (videosources.Count > this.device.Key && devices.Count > 1)
            {
                videoSource = new VideoCaptureDevice(videosources[this.get_device().Key].MonikerString);
                string solution = "0;0";
                solution = get_solution(videoSource).Value;

                //Dem Webcam Objekt ermittelte Auflösung übergeben
                videoSource.DesiredFrameSize = videoSource.VideoCapabilities[Convert.ToInt32(solution.Split(';')[1])].FrameSize;
                //pic.Size = new Size(videoSource.DesiredFrameSize.Width, videoSource.DesiredFrameSize.Height);
                //form.Size = new Size(videoSource.DesiredFrameSize.Width +100, videoSource.DesiredFrameSize.Height +100);
                pic.SizeMode = PictureBoxSizeMode.Zoom;
            //
                //NewFrame Eventhandler zuweisen anlegen.
                //(Dieser registriert jeden neuen Frame der Webcam)
                videoSource.NewFrame += new AForge.Video.NewFrameEventHandler(videoSource_NewFrame);
                //  videoSource.SnapshotFrame += new AForge.Video.NewFrameEventHandler(videoSource_NewFrame);
                //Das Aufnahmegerät aktivieren
                videoSource.Start();
            }
        }
Пример #5
0
 public void show_Webcam_picture(System.Windows.Forms.PictureBox webcamPictureBox, WebcamOptions form)
 {
     if (capture_possible)
     {
         model.show_picture(webcamPictureBox, form);
     }
 }
 public void show_Webcam_picture( System.Windows.Forms.PictureBox webcamPictureBox, WebcamOptions form)
 {
     if (capture_possible)
         model.show_picture(webcamPictureBox, form);
 }
 public void show_pictureTest()
 {
     PictureBox pic = new PictureBox();
     PixelState.getInstance().set_pictureBox(pic);
     WebcamModel target = new WebcamModel();
     Dictionary<int, string> devices = new Dictionary<int, string>();
     Dictionary<int, string> solutions = new Dictionary<int, string>();
     devices.Add(1,"");
     solutions.Add(1, "");
     WebcamOptions form = new WebcamOptions(devices, solutions);
     target.show_picture(pic, form);
 }