Created
May 9, 2019 04:12
-
-
Save qingswu/1df746a275ecc2a439715ffe567a72b9 to your computer and use it in GitHub Desktop.
Basic video capture template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <opencv2/highgui.hpp> | |
#include <opencv2/videoio.hpp> | |
int main(int argc, char** argv) { | |
cv::VideoCapture cap(0); | |
// cap.set(cv::CAP_PROP_FRAME_WIDTH, 1280); | |
// cap.set(cv::CAP_PROP_FRAME_HEIGHT, 720); | |
cv::Mat im; | |
while (true) { | |
cap >> im; | |
if (im.empty()) break; | |
cv::imshow("image", im); | |
int key = cv::waitKey(1); | |
if (key == 27) { | |
break; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment