Skip to content

Commit 64a9888

Browse files
opencv_demo: make camera ID configurable with flag '-c'
1 parent 0ad3b23 commit 64a9888

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

example/opencv_demo.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ int main(int argc, char *argv[])
5252
getopt_t *getopt = getopt_create();
5353

5454
getopt_add_bool(getopt, 'h', "help", 0, "Show this help");
55+
getopt_add_int(getopt, 'c', "camera", "0", "camera ID");
5556
getopt_add_bool(getopt, 'd', "debug", 0, "Enable debugging output (slow)");
5657
getopt_add_bool(getopt, 'q', "quiet", 0, "Reduce output");
5758
getopt_add_string(getopt, 'f', "family", "tag36h11", "Tag family to use");
@@ -73,7 +74,7 @@ int main(int argc, char *argv[])
7374
meter.start();
7475

7576
// Initialize camera
76-
VideoCapture cap(0);
77+
VideoCapture cap(getopt_get_int(getopt, "camera"));
7778
if (!cap.isOpened()) {
7879
cerr << "Couldn't open video capture device" << endl;
7980
return -1;

0 commit comments

Comments
 (0)