private void Grab()
        {
            Mat mat = new Mat();

            capture.Grab();
            capture.Retrieve(mat);
            if (rec != null && !mat.Size.IsEmpty)
            {
                rec.Invoke(mat);
            }
        }
Example #2
0
      public void TestFileCaptureNonAscii()
      {
         String fileName = EmguAssert.GetFile("tree.avi");
         String newName = fileName.Replace("tree.avi", "树.avi");
         File.Copy(fileName, newName, true);
         VideoCapture capture = new VideoCapture(EmguAssert.GetFile(newName));
         int counter = 0;
         using (Mat m = new Mat())
         while (capture.Grab())
         {
            capture.Retrieve(m);
            counter++;
         }

         Trace.WriteLine(String.Format("{0} frames found in file {1}", counter, newName));
      }
Example #3
0
 public void TestCaptureFromFile()
 {
    using (VideoCapture capture = new VideoCapture(EmguAssert.GetFile( "tree.avi")))
    using (VideoWriter writer = new VideoWriter("tree_invert.avi", 10, new Size(capture.Width, capture.Height), true))
    {
       int maxCount = 10;
       Mat img = new Mat();
       while (capture.Grab() && maxCount > 0)
       {
          capture.Retrieve(img);
          CvInvoke.BitwiseNot(img, img);
          writer.Write(img);
          maxCount--;
       }
    }
 }