-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Cpp] Capturing Video
Yu Kobayashi edited this page Jun 27, 2015
·
6 revisions
// Opens MP4 file (ffmpeg is probably needed)
VideoCapture capture = new VideoCapture("aaa.mp4");
int sleepTime = (int) Math.Round(1000 / capture.Fps);
using (Window window = new Window("capture"))
using (Mat image = new Mat()) // Frame image buffer
{
// When the movie playback reaches end, Mat.data becomes NULL.
while (true)
{
capture.Read(image); // same as cvQueryFrame
if (image.Empty())
break;
window.ShowImage(image);
Cv2.WaitKey(sleepTime);
}
}