Exemple #1
0
        static void Main()
        {
            Console.WriteLine("Press ESC to stop playing");

            var reader = new CameraCapture(0); //capture from camera

            (reader as CameraCapture).FrameSize = new Size(640, 480);

            //reader = new FileCapture(Path.Combine(getResourceDir(), "Welcome.mp4")); //capture from video
            //reader = new ImageDirectoryCapture(Path.Combine(getResourceDir(), "Sequence"), "*.jpg");
            reader.Open();

            Bgr <byte>[,] frame = null;
            do
            {
                reader.ReadTo(ref frame);
                if (frame == null)
                {
                    break;
                }

                frame.Show(scaleForm: true);
            }while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape));

            reader.Dispose();
        }
        private void Btn_Open_Click(object sender, RoutedEventArgs e)
        {
            if (this.Comlist.SelectedItem.ToString() == "rtsp")
            {
                //string connStr = this.Comlist.SelectedItem.ToString() + "://" + this.txt_user.Text + ":" + this.txt_Passw.Text + "@" + this.txt_IP.Text + "/11";
                camera.Open(string.Format("rtsp://{0}:{1}@{2}/{3}", this.txt_user.Text, this.txt_Passw, this.txt_IP.Text, "11"));

                return;
            }
            else
            {
                MessageBox.Show("http");
                //string connStr = this.Comlist.SelectedItem.ToString() + "://" + this.txt_IP.Text + ":80/videostream.cgi?loginuse=" + this.txt_user.Text + "&loginpas="******"htttp://{0}:{1}/videostream.cgi?loginuse={2}&loginpas={3}", this.txt_IP.Text, "80", this.txt_user.Text, this.txt_Passw.Text));

                //未完
            }
        }
Exemple #3
0
 public MainWindow()
 {
     InitializeComponent();
     path = Environment.CurrentDirectory + "\\img\\";
     Directory.CreateDirectory(path);
     bmps[0]            = new BitmapImage(new Uri("/img/绿灯.PNG", UriKind.Relative));
     bmps[1]            = new BitmapImage(new Uri("/img/黄灯.PNG", UriKind.Relative));
     bmps[2]            = new BitmapImage(new Uri("/img/红灯.PNG", UriKind.Relative));
     timer.Interval     = new TimeSpan(0, 0, 1);
     timer.Tick        += Timer_Tick;
     rfid.DataReceived += Rfid_DataReceived;
     cam.Open("rtsp://*****:*****@172.10.48.15/11");
     cam.OnFrameChanged += Cam_OnFrameChanged;
 }
Exemple #4
0
        public CaptureWindow(int cameraIndex = -1)
        {
            InitializeComponent();
            pictureBox.SizeMode = PictureBoxSizeMode.Zoom;
            if (cameraIndex == -1)
            {
                return;
            }

            reader           = new CameraCapture(cameraIndex);
            reader.FrameSize = new Size(640, 480);
            reader.Open();

            this.Text         = "Camera " + cameraIndex;
            Application.Idle += capture_NewFrame;
        }
Exemple #5
0
        static void Main()
        {
            Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
            Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";runtimes/win10-x64/"); //only needed if projects are directly referenced

            Console.WriteLine("Press ESC to stop playing");

            List <CameraCapture> captures = new List <CameraCapture>();

            var cameraCount = CameraCapture.CameraCount;

            if (cameraCount == 0)
            {
                Console.WriteLine("No camera device is present.");
                return;
            }

            //initialize
            for (int camIdx = 0; camIdx < cameraCount; camIdx++)
            {
                var cap = new CameraCapture(camIdx);
                cap.Open();

                captures.Add(cap);
            }

            //grab frames
            Bgr <byte>[][,] frames = new Bgr <byte> [cameraCount][, ];
            do
            {
                for (int camIdx = 0; camIdx < cameraCount; camIdx++)
                {
                    captures[camIdx].ReadTo(ref frames[camIdx]);
                    if (frames[camIdx] == null)
                    {
                        break;
                    }

                    frames[camIdx].Show(String.Format("Camera {0}", camIdx), autoSize: true);
                }
            }while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape));

            //dispose
            captures.ForEach(x => x.Dispose());
            ImageUI.CloseAll();
        }
Exemple #6
0
        static void Main()
        {
            Console.WriteLine("Press ESC to stop playing");

            List <CameraCapture> captures = new List <CameraCapture>();

            var cameraCount = CameraCapture.CameraCount;

            if (cameraCount == 0)
            {
                Console.WriteLine("No camera device is present.");
                return;
            }

            //initialize
            for (int camIdx = 0; camIdx < cameraCount; camIdx++)
            {
                var cap = new CameraCapture(camIdx);
                cap.Open();

                captures.Add(cap);
            }

            //grab frames
            Bgr <byte>[][,] frames = new Bgr <byte> [cameraCount][, ];
            do
            {
                for (int camIdx = 0; camIdx < cameraCount; camIdx++)
                {
                    captures[camIdx].ReadTo(ref frames[camIdx]);
                    if (frames[camIdx] == null)
                    {
                        break;
                    }

                    frames[camIdx].Show(String.Format("Camera {0}", camIdx), scaleForm: false);
                }
            }while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape));

            //dispose
            captures.ForEach(x => x.Dispose());
            UI.CloseAll();
        }
Exemple #7
0
 /// <summary>
 /// 打开摄像头
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     camera.Open("rtsp://*****:*****@192.168.1.245/11");
     camera.OnFrameChanged += xc;
 }