Exemple #1
0
 public Form1()
 {
     InitializeComponent();
     device = new NmeaParser.SerialPortDevice(new System.IO.Ports.SerialPort("COM3", 4800));
     device.MessageReceived += Device_MessageReceived;;
     device.OpenAsync();
     stream1.NewFrame       += Stream1_NewFrame;
     stream2.NewFrame       += Stream2_NewFrame;
     comboBox1.SelectedIndex = 0;
     comboBox2.SelectedIndex = 1;
     stream1.Start();
     stream2.Start();
     UpdateStreamSources();
     button1.BackColor = Color.Green;
 }
        private void BtnAGVConnect_Click(object sender, EventArgs e)
        {
            #region TCP/IP 통신
            string AGVIP   = dgvAGVList.CurrentRow.Cells[2].ToString();
            string AGVPort = dgvAGVList.CurrentRow.Cells[3].ToString();

            // (2) 서버에 연결
            IPEndPoint ep = new IPEndPoint(IPAddress.Parse(AGVIP), int.Parse(AGVPort));   // Server_IP, Port 번호

            #endregion

            #region 카메라 스트리밍
            var CamIP   = dgvAGVList.CurrentRow.Cells[4].Value;
            var CamPort = dgvAGVList.CurrentRow.Cells[5].Value;

            string CAM = "http://" + CamIP + ":" + CamPort;

            sock.Connect(ep);

            string data         = string.Empty;
            byte[] receiverBuff = new byte[8192];
            //stream = new MJPEGStream(CAM);
            stream = new MJPEGStream("http://192.168.4.2:8080");

            stream.Start();
            #endregion

            var MapAddress = dgvAGVList.CurrentRow.Cells[6].Value.ToString();

            OnConnect_Click(sock, stream, MapAddress);
        }
Exemple #3
0
        private void btn_playPause_Click(object sender, EventArgs e)
        {
            i++;
            if (i % 2 == 0)
            {
                this.btn_playPause.Image = ((System.Drawing.Image)(Properties.Resources.playIcon));

                btn_capImage.Enabled = false;
                videoSource.SignalToStop();
                videoSource.WaitForStop();
                videoSource.Stop();
            }
            else
            {
                new Thread(() => {
                    Thread.CurrentThread.IsBackground = true;
                    btn_capImage.Enabled     = true;
                    videoSource.Login        = camUsername;
                    videoSource.Password     = camPassword;
                    this.btn_playPause.Image = ((System.Drawing.Image)(Properties.Resources.pauseIcon));
                    videoSource.NewFrame    += new NewFrameEventHandler(video_NewFrame);
                    videoSource.Start();
                }).Start();
            }
        }
Exemple #4
0
        void LoadCam2()
        {
            MJPEGStream stream2 = new MJPEGStream(ip2);

            stream2.NewFrame += Stream2_NewFrame;
            stream2.Start();
        }
Exemple #5
0
        void LoadCam1()
        {
            MJPEGStream stream1 = new MJPEGStream(ip1);

            stream1.NewFrame += Stream1_NewFrame;
            stream1.Start();
        }
Exemple #6
0
        void LoadCam4()
        {
            MJPEGStream stream4 = new MJPEGStream(ip4);

            stream4.NewFrame += Stream4_NewFrame;
            stream4.Start();
        }
Exemple #7
0
 public void update(bool state, string ip = "192.168.137.69", int port = 8091)
 {
     if (state) //Start Stream
     {
         stream.Source = "http://" + ip + ":" + port.ToString() + "/?action=stream";
         if (!stream.IsRunning)
         {
             stream.Start();
         }
     }
     else
     {
         try
         {
             if (stream.IsRunning)
             {
                 if (stream.FramesReceived > 0)
                 {
                     //stream.Stop();
                 }
                 stream.Stop();
             }
             else
             {
                 return;
             }
         }
         catch (Exception e)
         {
             Console.WriteLine("", e);
         }
     }
 }
Exemple #8
0
 public CameraStreamView()
 {
     InitializeComponent();
     myStream           = new MJPEGStream("http://192.168.0.21:8081");
     myStream.NewFrame += stream_NewFrame;
     myStream.Start();
 }
        private void BtnAGVConnect_Click(object sender, EventArgs e)
        {
            //#region TCP/IP 통신
            //string AGVIP = dgvAGVList.CurrentRow.Cells[2].ToString();
            //string AGVPort = dgvAGVList.CurrentRow.Cells[3].ToString();

            //// (2) 서버에 연결
            //IPEndPoint ep = new IPEndPoint(IPAddress.Parse(AGVIP), int.Parse(AGVPort));   // Server_IP, Port 번호

            //#endregion

            #region 카메라 스트리밍
            var CamIP   = dgvAGVList.CurrentRow.Cells[4].Value;
            var CamPort = dgvAGVList.CurrentRow.Cells[5].Value;

            //string CAM = "http://" + CamIP + ":" + CamPort;
            string CAM = "http://" + CamIP + ":" + CamPort;

            //sock.Connect(ep);

            string data         = string.Empty;
            byte[] receiverBuff = new byte[8192];
            stream = new MJPEGStream(CAM);

            stream.Start();
            //stream.NewFrame += stream_NewFrame;
            #endregion

            OnConnect_Click(sock, stream);
        }
Exemple #10
0
 private void btnStartStopVideo_Click(object sender, EventArgs e)
 {
     if (lbCameras.SelectedIndex < 0)
     {
         MessageBox.Show("当前没有选择相机,请先选择一个相机!");
         return;
     }
     if (videoStream.IsRunning)
     {
         videoStream.Stop();
         videoWriter.Close();    // 保存视频文件
         File.Move("_video_saved\\recording.avi",
                   string.Format("_video_saved\\{0}-{1}.avi",
                                 curCamera.ToString(),
                                 DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss")));
         curCamera = null;
         timerGetData.Stop();   // 关闭同时关闭计时器
         pbCameraView.Image          = global::Monitor.Properties.Resources.no_video;
         btnStartStopVideo.Text      = "显示视频";
         btnStartStopVideo.BackColor = Color.LightGreen;
         labelVideoInfo.Text         = "请先在左侧选择相机,然后点击“显示视频”";
     }
     else
     {
         curCamera          = cameras[lbCameras.SelectedIndex];
         videoStream.Source = string.Format(videoUrlFormatter, curCamera.ip, curCamera.port);
         videoStream.Start();
         videoWriter.Open("_video_saved\\recording.avi", 352, 288); // 创建视频文件
         timerGetData.Start();                                      // 启动同时开始计时器
         btnStartStopVideo.Text      = "关闭视频";
         btnStartStopVideo.BackColor = Color.LightCoral;
         labelVideoInfo.Text         = curCamera.ToFullString();
     }
 }
Exemple #11
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (streamLocCam.Checked == true)
     {
         if (button2.Text == "Start Camera")
         {
             kamera           = new VideoCaptureDevice(webCams[comboBox1.SelectedIndex].MonikerString);
             kamera.NewFrame += new NewFrameEventHandler(video_NewFrame);
             kamera.Start();
             button2.Text = "Stop Camera";
         }
         else
         {
             kamera.SignalToStop();
             kamera       = null;
             button2.Text = "Start Camera";
         }
     }
     else
     {
         if (button2.Text == "Start Camera")
         {
             stream           = new MJPEGStream("http://" + inputIP.Text + "/video");
             stream.NewFrame += new NewFrameEventHandler(video_NewFrame);
             stream.Start();
             button2.Text = "Stop Camera";
         }
         else
         {
             stream.SignalToStop();
             stream       = null;
             button2.Text = "Start Camera";
         }
     }
 }
Exemple #12
0
        private void DoWork(object context)
        {
            var controller = (ServerController)context;

            using (var results = new MessageRouterResults(controller.Log, controller.Model.Settings.TargetQueueConfig))
            {
                controller.Log.Info("Connecting to {0}", controller.Model.Settings.CameraConnection.Title);

                var mjpegConnection = new MJPEGStream
                {
                    Source   = controller.Model.Settings.CameraConnection.Uri,
                    Login    = controller.Model.Settings.CameraConnection.User,
                    Password = controller.Model.Settings.CameraConnection.Password,
                };

                mjpegConnection.NewFrame += (x, y) => OnNewFrame(controller, results, y);
                mjpegConnection.Start();
                try
                {
                    while (true)
                    {
                        Thread.Sleep(100);
                    }
                }
                catch (ThreadAbortException e)
                {
                    mjpegConnection.Stop();
                }
            }
        }
        private void OpenMjpeg(string path)
        {
            MJPEGStream videoStream = new MJPEGStream();

            FormClosing += (o, args) => {
                videoStream.Stop();
            };
            videoStream.VideoSourceError += (o, args) => {
                MessageBox.Show(args.Description);
            };
            videoStream.Source = path;

            videoStream.Start();

            videoInfoToolStripMenuItem.Enabled = false;
            _isFrameReady                = false;
            _isVideoProcessing           = true;
            progressBar.Value            = 0;
            progressBar.Maximum          = 1;
            buttonPlay.Image             = Resources.if_PauseDisabled_22964;
            buttonPlay.Enabled           = false;
            labelTimeProgressFinish.Text = "-";

            Play(videoStream);
            timer.Enabled = false;
        }
Exemple #14
0
        private void button2_Click(object sender, EventArgs e)
        {
            mpeg = new MJPEGStream();
            AForge.Video.DirectShow.VideoCaptureDevice fcg = new AForge.Video.DirectShow.VideoCaptureDevice();
            mpeg.Login    = "******";
            mpeg.Password = "******";
            mpeg.Source   = "http://192.168.1.111/GetData.cgi";
            AsyncVideoSource asyncSource = new AsyncVideoSource(mpeg);

            mpeg.NewFrame += new NewFrameEventHandler(cam_NewFrame);
            mpeg.Start();

            Timer ti = new Timer();

            /* sec = 0;
             *
             * frame_count = 0;
             * //usbCam = new FilterInfoCollection(FilterCategory.VideoInputDevice);
             * //cam = new VideoCaptureDevice(usbCam[0].MonikerString);
             * VideoCaptureDeviceForm Video_Input = new VideoCaptureDeviceForm();
             * Video_Input.ShowDialog();
             * cam =new VideoCaptureDevice(Video_Input.VideoDeviceMoniker);
             * cam.NewFrame +=new  NewFrameEventHandler(cam_NewFrame);
             * cam.Start();*/


            ti.Interval = 1000;
            ti.Tick    += new EventHandler(time);
            ti.Start();
        }
Exemple #15
0
 public void CameraUpdate(int state, string ip = "192.168.137.69", int port = 8091)
 {
     //stream.Source = "http://" + ip + ":" + port.ToString() + "/?action=stream";
     if (state == 1)
     {
         if (stream.IsRunning)
         {
         }
         else
         {
             stream.Start();
         }
     }
     else
     {
         if (stream.IsRunning)
         {
             stream.Stop();
         }
         else
         {
             return;
         }
     }
 }
Exemple #16
0
 private void button2_Click(object sender, EventArgs e)
 {
     stream.Source = Interaction.InputBox("Please Enter Stream Source URL", "Stream URL", "http://192.168.1.128:8080/video");
     stream.Stop();
     pictureBox1.Image = null;
     stream.Start();
 }
Exemple #17
0
 private void btnKetNoi_Click(object sender, EventArgs e)
 {
     if (btnKetNoi.Text == "Kết nối ứng dụng")
     {
         if (txtURL.Text.Trim() == "" || txtURL.Text.Trim() == null)
         {
             MessageBox.Show("Bạn chưa kết nối ứng dụng");
         }
         else
         {
             picQR.Visible    = true;
             Stream           = new MJPEGStream(txtURL.Text);
             Stream.NewFrame += stream_NewFrame;
             Stream.Start();
             timer1.Enabled = true;
             timer1.Start();
             btnKetNoi.Text = "Ngắt ứng dụng";
         }
     }
     else
     {
         picQR.Visible  = false;
         btnKetNoi.Text = "Kết nối ứng dụng";
         timer1.Stop();
         Stream.Stop();
         timer1.Enabled = false;
     }
 }
Exemple #18
0
        void LoadCam3()
        {
            MJPEGStream stream3 = new MJPEGStream(ip3);

            stream3.NewFrame += Stream3_NewFrame;
            stream3.Start();
        }
        private void btConnect_Click(object sender, EventArgs e)
        {
            if (btConnect.Text == "Kết nối")
            {
                if (tbSearch.text.Trim() == "" || tbSearch.text.Trim() == null)
                {
                    MessageBox.Show("Bạn chưa kết nối ứng dụng");
                }
                else
                {
                    pictureBox1.Visible = true;
                    Stream           = new MJPEGStream(tbSearch.text);
                    Stream.NewFrame += stream_NewFrame;
                    Stream.Start();
                    timer1.Enabled = true;
                    timer1.Start();

                    btConnect.Text = "Ngừng";
                    //btConnect.Iconimage = Image.FromFile("..//..//..//..//image//icondis.png");
                }
            }
            else
            {
                pictureBox1.Visible = false;
                btConnect.Text      = "Kết nối";
                //btConnect.Iconimage = Image.FromFile("..//..//..//..//image//iconconnect.png");
                timer1.Stop();
                Stream.Stop();
                timer1.Enabled = false;
            }
        }
        private void startCamBtn_Click(object sender, EventArgs e)
        {
            stream           = new MJPEGStream("http://" + deviceIP + ":8080/");
            stream.NewFrame += stream_NewFrame;

            stream.Start();
        }
Exemple #21
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            pictureBox1.Show();
            entity101vision.Start();

            dataGridView1.Hide();
            dataGridView2.Hide();
        }
Exemple #22
0
        public Form1()
        {
            InitializeComponent();

            stream           = new MJPEGStream("http://192.168.1.105:8099/videostream.cgi?user=admin&pwd=Foscam12chan");
            stream.NewFrame += new NewFrameEventHandler(video_NewFrame);
            stream.Start();
        }
 public CameraAnalyzeService(IFaceRecognitionService recognitionService, Camera camera)
 {
     _recognitionService = recognitionService;
     _camera             = camera;
     _stream             = new MJPEGStream(camera.IPAddress);
     _stream.NewFrame   += OnFrameReceived;
     _stream.Start();
 }
Exemple #24
0
        public Form1()
        {
            InitializeComponent();
            stream = new MJPEGStream("http://192.168.0.232:8090/?action=stream"); // 720x480 : 화면 비율
            stream.Start();

            stream.NewFrame += stream_NewFrame;
        }
Exemple #25
0
        private void cmdStart_Click(object sender, EventArgs e)
        {
            //sets the IP Adress to the value entered in the text field
            string IPAdress = txtIPInput.Text;

            stream           = new MJPEGStream("http://" + IPAdress + "/");
            stream.NewFrame += Stream_NewFrame;
            stream.Start();
        }
Exemple #26
0
        private void ConnectButton_Clicked(object sender, RoutedEventArgs e)
        {
            var streamSource = ProcessCameraUrl(CameraUrlTextBox.Text);

            stream           = new MJPEGStream(streamSource);
            stream.NewFrame += StreamNewFrame;

            stream.Start();
        }
Exemple #27
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     // stream = new MJPEGStream("http://10.20.2.158:8080/?action=stream");
     stream           = new MJPEGStream("http://" + TbIpSousMarinUDP.Text + ":8080/?action=stream");
     stream.NewFrame += new AForge.Video.NewFrameEventHandler(VideoStream_NewFrame);
     stream.Start();
     //
     BtnEnregistrer.Enabled = true;
 }
Exemple #28
0
 private void button6_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != "null")
     {
         stream           = new MJPEGStream(textBox1.Text);
         stream.NewFrame += stream_NewFrame;
         stream.Start();
     }
 }
Exemple #29
0
 public SelectedCamForm(Cell _cell, MJPEGStream mJPEGStream, Action <Image <Bgr, byte>, ImageBox, CascadeClassifier> _DetectShowGuess)
 {
     InitializeComponent();
     DetectShowGuess = _DetectShowGuess;
     cell            = _cell;
     grid1.AdjustCells(1);
     mJPEGStream.NewFrame += newFrameEventHandler;
     mJPEGStream.Start();
 }
Exemple #30
0
 private void cameraInitialize()
 {
     /***** CAMERA INITIALIZE *****/
     stream           = new MJPEGStream("http://" + textBoxIP.Text + ":" + textBoxPort.Text + "/?action=stream");
     stream.NewFrame += new NewFrameEventHandler(newFrame);
     stream.Stop();
     stream.Source = "http://" + textBoxIP.Text + ":" + textBoxPort.Text + "/?action=stream";
     stream.Start();
     /***** CAMERA INITIALIZE *****/
 }