Start A Scanner Darkly
This commit is contained in:
parent
5aa1854757
commit
ec06a3aa22
|
@ -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} )
|
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue