Start A Scanner Darkly

This commit is contained in:
The Magician 2024-05-14 15:48:47 +01:00
parent 5aa1854757
commit ec06a3aa22
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.2)
project( AScannerDarkly )
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( AScannerDarkly main.cpp )
target_link_libraries( AScannerDarkly ${OpenCV_LIBS} )

29
a_scanner_darkly/main.cpp Normal file
View File

@ -0,0 +1,29 @@
#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);
}