96d61f3d |
1 | /* |
6f2d32c6 |
2 | Copyright (C) 2016 Daniel Watson |
96d61f3d |
3 | See the end of the file for license conditions. |
4 | */ |
5 | /* challenge-bot |
6 | GNU AGPLv3 (or later at your option) |
7 | project available here: |
8 | https://challenge-bot.com/ |
9 | */ |
10 | #include <opencv2/opencv.hpp> |
11 | |
12 | using namespace cv; |
13 | using namespace std; |
14 | |
15 | int main(int argc, char** argv) { |
d3b41652 |
16 | if (argc < 2) { |
17 | cout << "supply a video device index." << endl; |
18 | cout << "probably 0 for beaglebone, 1 for laptop" << endl; |
19 | exit(0); } |
20 | VideoCapture camera(atoi(argv[1])); |
96d61f3d |
21 | if(!camera.isOpened()) { |
22 | cout << "not opened :( that's bad" << endl; |
23 | exit(-1); } |
d3b41652 |
24 | Mat frame; |
96d61f3d |
25 | camera >> frame; |
26 | Mat grey_image; |
27 | cvtColor(frame, grey_image, CV_BGR2GRAY); |
28 | |
29 | imwrite("image.png", frame); |
30 | imwrite("image-grey.png", grey_image); |
31 | return 0; } |
32 | |
33 | /* |
34 | This file is part of challenge-bot. |
35 | |
36 | Challenge-bot is free software: you can redistribute it and/or modify |
37 | it under the terms of the GNU Affero General Public License as published by |
38 | the Free Software Foundation, either version 3 of the License, or |
39 | (at your option) any later version. |
40 | |
6f2d32c6 |
41 | Challenge-bot is distributed in the hope that it will be useful, |
96d61f3d |
42 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
43 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
44 | GNU Affero General Public License for more details. |
45 | |
46 | You should have received a copy of the GNU Affero General Public License |
47 | along with challenge-bot. If not, see <http://www.gnu.org/licenses/>. |
48 | */ |