예제 #1
0
        /// <summary>
        /// Create a two pass video stabilizer.
        /// </summary>
        /// <param name="capture">The capture object to be stabilized. Should not be a camera stream.</param>
        public TwoPassStabilizer(Capture capture)
        {
            if (capture.CaptureSource == Capture.CaptureModuleType.Camera)
            {
                throw new ArgumentException("Two pass stabilizer cannot process camera stream");
            }

            _captureFrameSource = new CaptureFrameSource(capture);

            _ptr = VideoStabInvoke.TwoPassStabilizerCreate(_captureFrameSource, ref _stabilizerBase, ref _frameSourcePtr);
        }
예제 #2
0
파일: Class1.cs 프로젝트: Warren-GH/emgucv
 public static void TestCaptureFrameSource()
 {
    ImageViewer viewer = new ImageViewer();
    using (Capture capture = new Capture())
    using (CaptureFrameSource frameSource = new CaptureFrameSource(capture))
    {
       Application.Idle += delegate(object sender, EventArgs e)
       {
          Mat frame = frameSource.NextFrame();
          if (frame != null)
             viewer.Image = frame;
       };
       viewer.ShowDialog();
    }
 }
예제 #3
0
파일: Class1.cs 프로젝트: Warren-GH/emgucv
 public static void TestTwoPassVideoStabilizer()
 {
    ImageViewer viewer = new ImageViewer();
    using (Capture capture = new Capture("tree.avi"))
    using (GaussianMotionFilter motionFilter = new GaussianMotionFilter(15, -1.0f))
    //using (Features2D.FastDetector detector = new Features2D.FastDetector(10, true))
    //using (Features2D.SURF detector = new Features2D.SURF(500, false))
    //using (Features2D.ORBDetector detector = new Features2D.ORBDetector(500))
    using (CaptureFrameSource frameSource = new CaptureFrameSource(capture))
    using (TwoPassStabilizer stabilizer = new TwoPassStabilizer(frameSource))
    {
       Stopwatch watch = new Stopwatch();
       //stabilizer.SetMotionEstimator(motionEstimator);
       Application.Idle += delegate(object sender, EventArgs e)
       {
          watch.Reset();
          watch.Start();
          Mat frame = stabilizer.NextFrame();
          watch.Stop();
          if (watch.ElapsedMilliseconds < 200)
          {
             Thread.Sleep(200 - (int) watch.ElapsedMilliseconds);
          }
          if (frame != null)
             viewer.Image = frame;
       };
       viewer.ShowDialog();
    }
 }
예제 #4
0
파일: Class1.cs 프로젝트: Warren-GH/emgucv
      /*
      public static void TestOnePassVideoStabilizerCamera()
      {
         ImageViewer viewer = new ImageViewer();
         using (Capture capture = new Capture())
         using (GaussianMotionFilter motionFilter = new GaussianMotionFilter())
         //using (Features2D.FastDetector detector = new Features2D.FastDetector(10, true))
         using (Features2D.SURF detector = new Features2D.SURF(500, false))
         //using (Features2D.ORBDetector detector = new Features2D.ORBDetector(500))
         using (OnePassStabilizer stabilizer = new OnePassStabilizer(capture))
         {
            stabilizer.SetMotionFilter(motionFilter);
            //motionEstimator.SetDetector(detector);

            //stabilizer.SetMotionEstimator(motionEstimator);
            Application.Idle += delegate(object sender, EventArgs e)
            {
               Image<Bgr, byte> frame = stabilizer.NextFrame();
               if (frame != null)
                  viewer.Image = frame;
            };
            viewer.ShowDialog();
         }
      }*/

      public static void TestOnePassVideoStabilizer()
      {
         ImageViewer viewer = new ImageViewer();
         using (Capture capture = new Capture("tree.avi"))
         using (CaptureFrameSource frameSource = new CaptureFrameSource(capture))
         using (OnePassStabilizer stabilizer = new OnePassStabilizer(frameSource))
         {
            Stopwatch watch = new Stopwatch();
            //stabilizer.SetMotionEstimator(motionEstimator);
            Application.Idle += delegate(object sender, EventArgs e)
            {
               watch.Reset();
               watch.Start();
               Mat frame = stabilizer.NextFrame();
               watch.Stop();
               if (watch.ElapsedMilliseconds < 200)
               {
                  Thread.Sleep(200 - (int)watch.ElapsedMilliseconds);
               }
               if (frame != null)
                  viewer.Image = frame;
            };
            viewer.ShowDialog();
         }
      }
예제 #5
0
 /// <summary>
 /// Create a one pass stabilizer
 /// </summary>
 /// <param name="capture">The capture object to be stabalized</param>
 public OnePassStabilizer(Capture capture)
 {
     _captureFrameSource = new CaptureFrameSource(capture);
     _ptr = VideoStabInvoke.OnePassStabilizerCreate(_captureFrameSource, ref _stabilizerBase, ref _frameSourcePtr);
 }