public StereoGeminateAForgeFileVideoStreamProvider(String fileName, int frameInterval)
 {
     VideoFileSource fileVideo = new VideoFileSource(fileName);
     this.frameInterval = fileVideo.FrameInterval = (int)(1.0 / 30 * 1000);
     //VideoFileSource f = new VideoFileSource("");
     asyncVideoSource = new AsyncVideoSource(fileVideo);
     this.Init();
     asyncVideoSource.NewFrame += NewFrameCallback;
 }
Ejemplo n.º 2
0
        /// <summary> release everything. </summary>
        public static void Dispose()
        {
            try
            {
                asyncSource.Stop();

                asyncSource = null;
            }
            catch { }

            asyncSource_NewFrame(null, new NewFrameEventArgs(null));
        }
Ejemplo n.º 3
0
        public static void Start(VideoCaptureDevice videoSource)
        {
            videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

            //VideoCaptureDevice videoSource = new VideoCaptureDevice(videoDevices[Device].MonikerString);
            videoSource.DesiredFrameRate = 25;


            asyncSource = new AsyncVideoSource(videoSource, true);

            asyncSource.NewFrame += new NewFrameEventHandler(asyncSource_NewFrame);
            asyncSource.Start();

        }
Ejemplo n.º 4
0
    private AsyncVideoSource videoSource; // Implements IVideoSource

    #endregion

    #region Constructor

    public FileStreamCamera(string videoFilename, bool skipFramesIfBusy)
    {
      ClearROI();

      this.videoFilename = videoFilename;
      videoSource = new AsyncVideoSource(new FileVideoSource(videoFilename));
      videoSource.SkipFramesIfBusy = skipFramesIfBusy;

      if (videoSource != null)
      {
        videoSource.NewFrame += new NewFrameEventHandler(videoSource_NewFrame);
        videoSource.VideoSourceError += new VideoSourceErrorEventHandler(videoSource_VideoSourceError);
        videoSource.PlayingFinished += new PlayingFinishedEventHandler(videoSource_PlayingFinished);
      }
    }
Ejemplo n.º 5
0
 public YAMDDetector(IVideoSource source, Magnitude low, Magnitude medium, Magnitude high)
 {
     detector = new MotionDetector(
         new SimpleBackgroundModelingDetector(),
         new BlobCountingObjectsProcessing(true));
     //async video source processes images in a separate thread and uses the NewFrame event
     inputStream = new AsyncVideoSource(source);
     inputStream.NewFrame += inputStream_NewFrame;
     this.low = low;
     this.medium = medium;
     this.high = high;
     timer = new Stopwatch();
     stoptimer = new Stopwatch();
     videoRecorder = new VideoFileWriter();
     Running = false;
     buffer = new FixedSizeQueue<Bitmap>();
     buffer.Limit = 50;
     magnitudes = new Queue<int>();
 }
Ejemplo n.º 6
0
        // Open video source
        private void OpenVideoSource(IVideoSource source)
        {
            // set busy cursor
            this.Cursor = Cursors.WaitCursor;

            // close previous video source
            videoSourcePlayer.SignalToStop();
            videoSourcePlayer.WaitForStop();

            //add asynch layer
            AsyncVideoSource asyncSource = new AsyncVideoSource(source, true);
            // set NewFrame event handler
            asyncSource.NewFrame += new NewFrameEventHandler(videoSourcePlayer_NewFrame);
            // start the video source
            asyncSource.Start();


            // start new video source
            videoSourcePlayer.VideoSource = asyncSource;
            videoSourcePlayer.Start();

            this.Cursor = Cursors.Default;
        }
Ejemplo n.º 7
0
        private void button2_Click(object sender, EventArgs e)
        {
            /*
            FilterInfoCollection CamCollection = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            VideoCaptureDevice stream = new VideoCaptureDevice(CamCollection[0].MonikerString);
            */

            MJPEGStream stream = new MJPEGStream("http://192.168.0.16:8080/videofeed");
               stream.Login = "******";
               stream.Password = "******";

            mov2 = false;
            mov = true;

            framesProcessing.fWidth = 640*2;
            framesProcessing.fHeight = 720;

            //Bitmap plate = new Bitmap("C:\\Users\\User\\Desktop\\tesis\\placa4.png");
            //getPlateLetters(plate);
            //persistDBLog("KFM276", "A-3");
            //Bitmap a = new Bitmap(@"placa1.jpg");
            //pictureBox3.Image = a;

            //pictureBox3.SizeMode = PictureBoxSizeMode.StretchImage;
            //catchPlate(a);

            //Set Timer <-----------------

            timer1.Tick += new EventHandler(timer_tick);
            timer1.Interval = 1000; //miliseconds
            timer1.Start();

            cont = 0;
            asyncSource = new AsyncVideoSource(stream);

            // set NewFrame event handler
            asyncSource.NewFrame += new NewFrameEventHandler(video_NewFrame);

            // start the video source
            asyncSource.Start();
        }
 public override void ChangeRightCap(int rightCapId)
 {
     this.RightCapture.Stop();
     var videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
     var rightCaptureDevice = new VideoCaptureDevice(videoDevices[rightCapId].MonikerString);
     this.RightCapture = new AsyncVideoSource(rightCaptureDevice);
     this.RightCapture.NewFrame += NewRightFrame;
     this.RightCapture.Start();
 }
Ejemplo n.º 9
0
 public override void Cleanup()
 {
   videoSource = null;
 }
Ejemplo n.º 10
0
 private void StartIPCam(CaptureDevice selectedDevice)
 {
     var stream = new JPEGStream(selectedDevice.Id);
     // create async video source
     var asyncSource = new AsyncVideoSource(stream);
     // set NewFrame event handler
     asyncSource.NewFrame += FrameReady;
     // start the video source
     asyncSource.Start();
 }