TheMathemagicians/a_scanner_darkly/main.cpp

30 lines
471 B
C++

#include <opencv2/opencv.hpp>
const std::string WINDOW_NAME = "A Scanner Darkly";
int main(int argc, char** argv ) {
cv::VideoCapture cap;
cap.open(0);
if (!cap.isOpened()) {
std::cerr << "Couldn't open capture" << std::endl;
return -1;
}
cv::namedWindow(WINDOW_NAME);
cv::Mat frame;
while (true) {
cap >> frame;
cv::imshow(WINDOW_NAME, frame);
char c = (char)cv::waitKey(33);
if (c == 27) {
break;
}
}
cv::destroyWindow(WINDOW_NAME);
}