fixed compile error
[profile/ivi/automotive-message-broker.git] / plugins / opencvlux / opencvluxplugin.h
1 /*
2 Copyright (C) 2012 Intel Corporation
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19 #ifndef OPENCVLUXPLUGIN_H
20 #define OPENCVLUXPLUGIN_H
21
22 #include <abstractsource.h>
23 #include <string>
24
25 #include <opencv/cv.h>
26 #include <opencv2/highgui/highgui.hpp>
27
28 #include <QObject>
29
30 using namespace std;
31
32 class OpenCvLuxPlugin: public QObject, public AbstractSource
33 {
34 Q_OBJECT
35 public:
36
37         struct Shared
38         {
39                 cv::VideoCapture *m_capture;
40                 PropertyList mRequests;
41                 OpenCvLuxPlugin* parent;
42
43                 double fps;
44                 bool threaded;
45                 bool kinect;
46                 bool useOpenCl;
47         bool useCuda;
48                 int pixelLowerBound;
49                 int pixelUpperBound;
50         };
51
52         OpenCvLuxPlugin(AbstractRoutingEngine* re, map<string, string> config);
53         
54         const string uuid();
55         void getPropertyAsync(AsyncPropertyReply *reply);
56         void getRangePropertyAsync(AsyncRangePropertyReply *reply);
57         AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
58         void subscribeToPropertyChanges(VehicleProperty::Property property);
59         void unsubscribeToPropertyChanges(VehicleProperty::Property property);
60         PropertyList supported();
61
62         int supportedOperations();
63         
64         void supportedChanged(PropertyList) {}
65         
66         void updateProperty(uint lux);
67
68 public Q_SLOTS:
69         void imgProcResult();
70
71         
72 private: /// methods:
73         bool init();
74
75 private:        
76         uint lastLux;
77         std::string device;
78         std::list<AsyncPropertyReply*> replyQueue;
79
80         Shared* shared;
81 };
82
83 static int grabImage(void *data);
84 static uint evalImage(cv::Mat qImg, OpenCvLuxPlugin::Shared *shared);
85
86 namespace TrafficLight
87 {
88 enum Color
89 {
90         Unknown = -1,
91         Red = 0,
92         Yellow,
93         Green
94 };
95 }
96
97 TrafficLight::Color detectLight(cv::Mat img, OpenCvLuxPlugin::Shared* shared);
98
99 #endif // EXAMPLEPLUGIN_H