libalvision  2.5.7.1
 All Classes Namespaces Files Functions Variables Friends Macros Pages
alvisionextractor.h
Go to the documentation of this file.
1 
7 #ifndef ALVISIONEXTRACTOR_H
8 #define ALVISIONEXTRACTOR_H
9 
11 #include <alvision/alimage.h>
12 #include <alcommon/albroker.h>
14 #include <qi/macro.hpp>
15 
16 namespace AL {
17 
18 class ALValue;
19 class ALVideoDeviceProxy;
20 class ALVisionExtractorPrivate;
21 
38 
39 public:
53  ALVisionExtractor(boost::shared_ptr<ALBroker> pBroker,
54  const std::string& pName,
55  int resolution=kQVGA, int colorspace=kBGRColorSpace,
56  int framerate=30, int activecamera=-1);
57 
58  virtual ~ALVisionExtractor();
59 
65  virtual bool setColorSpace(const int& colorSpace);
66 
72  virtual bool setFrameRate(const int& framerate);
73  virtual bool setFrameRate(const std::string &pSubscribedName,
74  const int& framerate);
75 
81  virtual bool setResolution(const int& resolution);
82 
88  virtual bool setActiveCamera(const int& cameraId);
89 
90  boost::shared_ptr<AL::ALVideoDeviceProxy> getVideoDeviceProxy();
91 
92  int getColorSpace();
93 
94  int getFrameRate();
95 
96  int getResolution();
97 
98  int getActiveCamera();
99 
100  bool isPaused();
101  bool isProcessing();
102 
103 
110  QI_API_DEPRECATED void setParameter(const std::string& paramName,
111  const ALValue& paramValue);
112 
116  virtual void start() = 0;
117 
123  virtual void process(ALImage* img) = 0;
124 
129  void pause(const bool& paused);
130 
134  virtual void stop() = 0;
135 
136  // Fix warning "hides overloaded virtual function"
137  // hidden overloaded virtual function 'AL::ALModule::stop'
138  // declared here: different number of parameters (1 vs 0)
139  using AL::ALModule::stop;
140 
150  int getDefaultPeriod();
151 
152 
160  int getMinimumPeriod();
161 
169  int getMaximumPeriod();
170 
171 
172 protected:
173  void xUpdateParameters(const int pPeriod, const float pPrecision);
174  void setSubscriptionParameters(const std::vector< std::pair<int, int> >& parameters);
175 
176 private:
177 
178  //intentionnally undefined.
179  ALVisionExtractor(const ALVisionExtractor& extractor);
180  //intentionnally undefined.
181  ALVisionExtractor& operator =(const ALVisionExtractor& extractor);
182 
183  void xStartDetection(const int pPeriod, const float pPrecision);
184  void xStopDetection();
185 
186  void xRun();
187 
188  ALVisionExtractorPrivate* _pImpl;
189 };
190 
191 } // namespace AL.
192 
193 #endif // ALVISIONEXTRACTOR_H
virtual bool setResolution(const int &resolution)
Sets processed image resolution on the fly.
const int kBGRColorSpace
void xUpdateParameters(const int pPeriod, const float pPrecision)
ALVisionExtractor(boost::shared_ptr< ALBroker > pBroker, const std::string &pName, int resolution=kQVGA, int colorspace=kBGRColorSpace, int framerate=30, int activecamera=-1)
Create a generic vision extractor.
vision defines
int getMinimumPeriod()
This method overrides the method inherited from ALExtractor. It computes the minimum period from the ...
const int kQVGA
ALVisionExtractor is a generic vision extractor.
virtual void start()=0
Method which will be called before each subscription to the extractor.
handle image
void setSubscriptionParameters(const std::vector< std::pair< int, int > > &parameters)
virtual void process(ALImage *img)=0
Method which will be called each time the extractor gets an image.
virtual ~ALVisionExtractor()
int getDefaultPeriod()
This method overrides the method inherited from ALExtractor. It computes the default period from the ...
QI_API_DEPRECATED void setParameter(const std::string &paramName, const ALValue &paramValue)
Set parameter value for resolution and pause.
virtual bool setActiveCamera(const int &cameraId)
Sets the camera from which the image is taken.
virtual bool setFrameRate(const int &framerate)
Sets extractor framerate on the fly.
virtual bool setColorSpace(const int &colorSpace)
Sets processed image colorspace on the fly.
int getMaximumPeriod()
This method overrides the method inherited from ALExtractor. It computes the maximum period from the ...
void pause(const bool &paused)
Pause the extractor, without calling the stop method.
boost::shared_ptr< AL::ALVideoDeviceProxy > getVideoDeviceProxy()
virtual void stop()=0
Method which will be called when the module is unsubscribed.