Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "opencv2/highgui/highgui.hpp"
- #include "opencv2/imgproc/imgproc.hpp"
- #include <iostream>
- using namespace cv;
- using namespace std;
- int main() {
- VideoCapture stream1(0); //0 is the id of video device.0 if you have only one camera.
- if (!stream1.isOpened()) { //check if video device has been initialised
- cout << "cannot open camera";
- }
- //unconditional loop
- while (true) {
- Mat cameraFrame;
- stream1.read(cameraFrame);
- imshow("cam", cameraFrame);
- if (waitKey(30) >= 0)
- break;
- }
- system("pause");
- return 0;
- }
- VideoCapture stream1("video.avi");
- stream1.read(cameraFrame);
- if (waitKey(30) >= 0)
- break;
- if( (char)waitKey(10) == 'q' )
- break;
Add Comment
Please, Sign In to add comment