title: Wpf - Can't grab frames from a video?
body: <p>I'm trying to grab all frames from my video in WPF and using emguCV 3.0.</p>
  
  <p>But the Retrive(frame, 0) always returns frame which has null Bitmap? </p>
  
  <p>I guess that the problem occurs in the Capture(string filename) but I don't know why it is.</p>
  
  <p>Can any one explain to me and give me some solutions?
  thanks.</p>
  
  <p>Here is my code</p>
  
  <pre><code>Capture _capture;
      private void btnCut_Click(object sender, RoutedEventArgs e)
              {
                  _capture = new Capture(@"H:\VisualC\HK5\LT Win\ForTesting\TestCutVideo\bin\Debug\Hay.mp4");
                  _capture.Start();
                  //bool isReading = true;
                  while (/*isReading*/_capture.Grab())
                  {
                      Mat frame = new Mat();
                      _capture.Retrieve(frame, 0);
                      if (frame != null)
                      {
                          imageArray.Add(frame);
                      }
  
                  }
  
                  //to Cut list of frames from video.
                  int start = 1, end = 10;
                  start = start * (int)_capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.Fps);
                  end = end * (int)_capture.GetCaptureProperty(Emgu.CV.CvEnum.CapProp.Fps);
                  VideoWriter vw = new VideoWriter("test.mp4", 15, new System.Drawing.Size(400, 400), true);
                  for (int i = start; i &lt;= end; i++)
                  {
                      vw.Write(imageArray[i]);
                  }
              }
  </code></pre>