2 Copyright (C) 2012 Intel Corporation
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.
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.
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
19 #ifndef OPENCVLUXPLUGIN_H
20 #define OPENCVLUXPLUGIN_H
22 #include <abstractsource.h>
26 #include <opencv/cv.h>
27 #include <opencv2/highgui/highgui.hpp>
34 class OpenCvLuxPlugin: public QObject, public AbstractSource
41 cv::VideoCapture *m_capture;
42 cv::VideoWriter *mWriter;
43 PropertyList mRequests;
44 OpenCvLuxPlugin* parent;
56 OpenCvLuxPlugin(AbstractRoutingEngine* re, map<string, string> config);
61 void getPropertyAsync(AsyncPropertyReply *reply);
62 void getRangePropertyAsync(AsyncRangePropertyReply *reply);
63 AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
64 void subscribeToPropertyChanges(VehicleProperty::Property property);
65 void unsubscribeToPropertyChanges(VehicleProperty::Property property);
66 PropertyList supported();
68 int supportedOperations();
70 void propertyChanged(AbstractPropertyType* value);
72 void supportedChanged(const PropertyList &);
74 void updateProperty(uint lux);
76 void writeVideoFrame(cv::Mat frame);
92 std::list<AsyncPropertyReply*> replyQueue;
94 std::unique_ptr<VehicleProperty::ExteriorBrightnessType> extBrightness;
100 static int grabImage(void *data);
101 static uint evalImage(cv::Mat qImg, OpenCvLuxPlugin::Shared *shared);
103 namespace TrafficLight
114 TrafficLight::Color detectLight(cv::Mat img, OpenCvLuxPlugin::Shared* shared);
116 #endif // EXAMPLEPLUGIN_H