Question

I have a EmguCv.Capture in 'Movie' class. I want to create a function that get a frame number and return this frame, like:

using Emgu.CV;
using Emgu.CV.Structure;

Class Movie
{
   private Capture capture;
   public Movie(string FileName)
   {
     capture=new Capture(FileName);
     ...
   }
   public Image<Bgr, byte> GetFrame(int FrameNum)
   {
    //return the FrameNum frame
   }
}

I need to do that as quickly as possible. Any ideas?

Was it helpful?

Solution

Have you tried using SetCaptureProperty method:

using Emgu.CV;
using Emgu.CV.Structure;

Class Movie
{
   private Capture capture;
   public Movie(string fileName)
   {
     capture = new Capture(fileName);
     ...
   }
   public Image<Bgr, byte> GetFrame(double frameNum)
   {
        capture.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_POS_FRAMES, frameNum);
        return capture.QueryFrame();
   }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top