コード例 #1
0
ファイル: Class1.cs プロジェクト: Warren-GH/emgucv
 public static void TestSuperres()
 {
    ImageViewer viewer = new ImageViewer();
    //using (Capture capture = new Capture("car.avi"))
    using (Superres.FrameSource frameSource = new Superres.FrameSource("car.avi", false))
    using (Superres.SuperResolution sr = new Superres.SuperResolution(Superres.SuperResolution.OpticalFlowType.Btvl, frameSource))
    //using (Superres.SuperResolution sr = new Superres.SuperResolution(Superres.SuperResolution.OpticalFlowType.BTVL1_OCL, frameSource))
    {
       Stopwatch watch = new Stopwatch();
       int counter = 0;
       Application.Idle += delegate(object sender, EventArgs e)
       {
          watch.Reset();
          watch.Start();
          
          //Image<Bgr, byte> frame = frameSource.NextFrame();
          Mat frame = new Mat(); 
          sr.NextFrame(frame);
          //Image<Gray, Byte> frame = capture.QueryGrayFrame();
          watch.Stop();
          if (watch.ElapsedMilliseconds < 200)
          {
             Thread.Sleep(200 - (int)watch.ElapsedMilliseconds);
          }
          if (!frame.IsEmpty)
          {
             viewer.Image = frame;
             viewer.Text = String.Format("Frame {0}: {1} milliseconds.", counter++, watch.ElapsedMilliseconds);
          } else
          {
             viewer.Text = String.Format("{0} frames processed", counter);
          }
       };
       viewer.ShowDialog();
    }
 }
コード例 #2
0
ファイル: SuperResolution.cs プロジェクト: gxliu/emgucv-code
 /// <summary>
 /// Create a super resolution solver for the given frameSource
 /// </summary>
 /// <param name="type">The type of optical flow algorithm to use</param>
 /// <param name="frameSource">The frameSource</param>
 public SuperResolution(SuperResolution.OpticalFlowType type, FrameSource frameSource)
     : base()
 {
     _ptr = SuperresInvoke.cvSuperResolutionCreate(type, frameSource, ref _frameSourcePtr);
 }
コード例 #3
0
ファイル: SuperResolution.cs プロジェクト: neutmute/emgucv
 /// <summary>
 /// Create a super resolution solver for the given frameSource
 /// </summary>
 /// <param name="type">The type of optical flow algorithm to use</param>
 /// <param name="frameSource">The frameSource</param>
 public SuperResolution(SuperResolution.OpticalFlowType type, FrameSource frameSource)
    : base()
 {
    _ptr = SuperresInvoke.cvSuperResolutionCreate(type, frameSource, ref _frameSourcePtr);
 }