[segmentation] Add video clip autorewind
authorDjordje Senicic <x0157990@ti.com>
Mon, 4 Mar 2019 12:43:58 +0000 (07:43 -0500)
committerDjordje Senicic <x0157990@ti.com>
Mon, 4 Mar 2019 12:43:58 +0000 (07:43 -0500)
Signed-off-by: Djordje Senicic <x0157990@ti.com>
examples/segmentation/main.cpp
examples/ssd_multibox/clips/pexels_videos_1466210.mp4 [new file with mode: 0644]
examples/ssd_multibox/clips/pexels_videos_3623.mp4 [new file with mode: 0644]

index 3e7238d1659d8da4303fda5f1f001a46df2a9b21..42fdfcb17af2656ce6527b8c346a64c9a094d713 100644 (file)
@@ -283,14 +283,24 @@ bool ReadFrame(ExecutionObjectPipeline &eop,
     }
     else
     {
-        // 640x480 camera input, process one in every 5 frames,
-        // can adjust number of skipped frames to match real time processing
-        if (! cap.grab())  return false;
-        if (! cap.grab())  return false;
-        if (! cap.grab())  return false;
-        if (! cap.grab())  return false;
-        if (! cap.grab())  return false;
-        if (! cap.retrieve(image)) return false;
+      if(opts.is_camera_input)
+      {
+         if (! cap.grab()) return false;
+         if (! cap.retrieve(image)) return false;
+      }
+      else
+      { //Video clip
+        if (cap.grab())
+        {
+          if (! cap.retrieve(image)) return false;
+        } else {
+          //Rewind!
+          std::cout << "Video clip rewinded!" << std::endl;
+          cap.set(CAP_PROP_POS_FRAMES, 0);
+          if (! cap.grab()) return false;
+            if (! cap.retrieve(image)) return false;
+        }
+      }
     }
 
     // scale to network input size 1024 x 512
diff --git a/examples/ssd_multibox/clips/pexels_videos_1466210.mp4 b/examples/ssd_multibox/clips/pexels_videos_1466210.mp4
new file mode 100644 (file)
index 0000000..7986b5c
Binary files /dev/null and b/examples/ssd_multibox/clips/pexels_videos_1466210.mp4 differ
diff --git a/examples/ssd_multibox/clips/pexels_videos_3623.mp4 b/examples/ssd_multibox/clips/pexels_videos_3623.mp4
new file mode 100644 (file)
index 0000000..5ec5d68
Binary files /dev/null and b/examples/ssd_multibox/clips/pexels_videos_3623.mp4 differ