Go to most recent revision | Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 3 | PointedEar | 1 | /*------------------------------------------------------------------------------------------*\ |
| 2 | This file contains material supporting chapter 3 of the cookbook: |
||
| 3 | Computer Vision Programming using the OpenCV Library. |
||
| 4 | by Robert Laganiere, Packt Publishing, 2011. |
||
| 5 | |||
| 6 | This program is free software; permission is hereby granted to use, copy, modify, |
||
| 7 | and distribute this source code, or portions thereof, for any purpose, without fee, |
||
| 8 | subject to the restriction that the copyright notice may not be removed |
||
| 9 | or altered from any source or altered source distribution. |
||
| 10 | The software is released on an as-is basis and without any warranties of any kind. |
||
| 11 | In particular, the software is not guaranteed to be fault-tolerant or free from failure. |
||
| 12 | The author disclaims all warranties with regard to this software, any use, |
||
| 13 | and any consequent failure, is purely the responsibility of the user. |
||
| 14 | |||
| 15 | Copyright (C) 2010-2011 Robert Laganiere, www.laganiere.name |
||
| 16 | \*------------------------------------------------------------------------------------------*/ |
||
| 17 | |||
| 18 | #include <opencv2/core/core.hpp> |
||
| 19 | #include <opencv2/highgui/highgui.hpp> |
||
| 20 | |||
| 21 | #include "colordetector.h" |
||
| 22 | |||
| 23 | int main() |
||
| 24 | { |
||
| 25 | // Create image processor object |
||
| 26 | ColorDetector cdetect; |
||
| 27 | |||
| 28 | // Read input image |
||
| 29 | cv::Mat image= cv::imread("boldt.jpg"); |
||
| 30 | if (!image.data) |
||
| 31 | return 0; |
||
| 32 | |||
| 33 | // set input parameters |
||
| 34 | cdetect.setTargetColor(130,190,230); // here blue sky |
||
| 35 | |||
| 36 | // Read image, process it and display the result |
||
| 37 | cv::namedWindow("result"); |
||
| 38 | cv::imshow("result",cdetect.process(image)); |
||
| 39 | |||
| 40 | cv::waitKey(); |
||
| 41 | |||
| 42 | return 0; |
||
| 43 | } |
||
| 44 |