Пример #1
0
 public void DetectFaceTest()
 {
     var fileName = @"C:\Users\Newton\Desktop\Video_1.avi";
     var videoReader = new VideoReader(fileName);
     var frame = videoReader.ReadVideoFrame();
     var luxand = new Luxand();
     while (frame != null)
     {
         System.Drawing.Bitmap bitmap = videoReader.ReadVideoFrame();
         if (bitmap == null)
         {
             continue;
         }
         var height = bitmap.Height;
         var width = bitmap.Width;
         Assert.IsTrue(height > 0 && width > 0);
         luxand.DetectFace(bitmap);
         Debug.WriteLine(string.Format("actualFrame: {0} - time: {1} seconds", videoReader.ActualFrame, Math.Round(videoReader.Time.TotalSeconds, 2)));
         Debug.WriteLine(string.Format("left: {0} - top: {1}", luxand.Left, luxand.Top));
     }
     videoReader.Close();
 }
Пример #2
0
 public void ReadVideo(string fileName)
 {
     Init();
     _videoProcessType = true;
     if (!File.Exists(fileName))
     {
         throw new FileNotFoundException("Archivo no encontrado.", fileName);
     }
     var videoReader = new VideoReader(fileName);
     var frame = videoReader.ReadVideoFrame();
     NumeroImagenActual++;
     TotalImagenes = (int)videoReader.FrameCount;
     _facialEmotionRecognition = new FacialEmotionRecognition(frame);
     while (frame != null && !_stop)
     {
         if (!_pause)
         {
             frame = videoReader.ReadVideoFrame();
             NumeroImagenActual++;
             if (frame == null)
             {
                 continue;
             }
             ProcessImage(frame);
         }
     }
     videoReader.Close();
 }