Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <opencv/cv.h>
- #include <opencv/highgui.h>
- #include <iostream>
- int main(int, char**)
- {
- cv::VideoCapture cap(0); // open the default camera
- if(!cap.isOpened()) { // check if we succeeded
- std::cout << "Camera not open!\n";
- return -1;
- }
- cv::namedWindow("Camera",1);
- cv::Mat frame;
- while (true) {
- cap >> frame; // get a new frame from camera
- cv::imshow("Camera", frame);
- if(cv::waitKey(30) >= 0) break;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement