X-Git-Url: http://challenge-bot.com/repos/?p=challenge-bot;a=blobdiff_plain;f=bbb%2Fopencv-hello-world%2Fopencv-hello-world.cpp;fp=bbb%2Fopencv-hello-world%2Fopencv-hello-world.cpp;h=55d58274ea17d2eea704dc4db1526202ccd2a5a8;hp=02fea3ea1c374657dd72e46cc28190b009c4076e;hb=d3b4165227672786b91d4850eb198b3524d7f49f;hpb=ba250b4c27713e8e040c0a28ecfbf8527bbe4d5c diff --git a/bbb/opencv-hello-world/opencv-hello-world.cpp b/bbb/opencv-hello-world/opencv-hello-world.cpp index 02fea3e..55d5827 100644 --- a/bbb/opencv-hello-world/opencv-hello-world.cpp +++ b/bbb/opencv-hello-world/opencv-hello-world.cpp @@ -13,13 +13,15 @@ using namespace cv; using namespace std; int main(int argc, char** argv) { - VideoCapture camera; - camera.open(0); - Mat edges; - Mat frame; + if (argc < 2) { + cout << "supply a video device index." << endl; + cout << "probably 0 for beaglebone, 1 for laptop" << endl; + exit(0); } + VideoCapture camera(atoi(argv[1])); if(!camera.isOpened()) { cout << "not opened :( that's bad" << endl; exit(-1); } + Mat frame; camera >> frame; Mat grey_image; cvtColor(frame, grey_image, CV_BGR2GRAY);