#include#include #include using namespace std; using namespace cv; int main() { Mat frame; //create a Mat object VideoCapture cap(0); //creates a VideoCapture object that links to the default device(number 0) on your computer namedWindow("Video"); while(char(waitKey(1))!='q'){ cap >> frame; //extracts a frame from the input device 'cap' to 'frame' imshow("Video",frame); } return 0; }
Tweak:
You can also play a video from a file.
create a VideoCapture object as:
VideoCapture cap("video.mp4");
No comments:
Post a Comment