| 1 | /* |
| 2 | Copyright (C) 2015 Daniel Watson |
| 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) { |
| 16 | VideoCapture camera; |
| 17 | camera.open(0); |
| 18 | Mat edges; |
| 19 | Mat frame; |
| 20 | if(!camera.isOpened()) { |
| 21 | cout << "not opened :( that's bad" << endl; |
| 22 | exit(-1); } |
| 23 | camera >> frame; |
| 24 | Mat grey_image; |
| 25 | cvtColor(frame, grey_image, CV_BGR2GRAY); |
| 26 | |
| 27 | imwrite("image.png", frame); |
| 28 | imwrite("image-grey.png", grey_image); |
| 29 | return 0; } |
| 30 | |
| 31 | /* |
| 32 | This file is part of challenge-bot. |
| 33 | |
| 34 | Challenge-bot is free software: you can redistribute it and/or modify |
| 35 | it under the terms of the GNU Affero General Public License as published by |
| 36 | the Free Software Foundation, either version 3 of the License, or |
| 37 | (at your option) any later version. |
| 38 | |
| 39 | GNU Affero Emacs is distributed in the hope that it will be useful, |
| 40 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 41 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 42 | GNU Affero General Public License for more details. |
| 43 | |
| 44 | You should have received a copy of the GNU Affero General Public License |
| 45 | along with challenge-bot. If not, see <http://www.gnu.org/licenses/>. |
| 46 | */ |