libalvision  2.1.4.13
 All Classes Namespaces Files Functions Variables 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 
145  int getDefaultPeriod();
146 
147 
155  int getMinimumPeriod();
156 
164  int getMaximumPeriod();
165 
166 
167 protected:
168  void xUpdateParameters(const int pPeriod, const float pPrecision);
169  void setSubscriptionParameters(const std::vector< std::pair<int, int> >& parameters);
170 
171 private:
172 
173  //intentionnally undefined.
174  ALVisionExtractor(const ALVisionExtractor& extractor);
175  //intentionnally undefined.
176  ALVisionExtractor& operator =(const ALVisionExtractor& extractor);
177 
178  void xStartDetection(const int pPeriod, const float pPrecision);
179  void xStopDetection();
180 
181  void xRun();
182 
183  ALVisionExtractorPrivate* _pImpl;
184 };
185 
186 } // namespace AL.
187 
188 #endif // ALVISIONEXTRACTOR_H
boost::shared_ptr< AL::ALVideoDeviceProxy > getVideoDeviceProxy()
virtual bool setColorSpace(const int &colorSpace)
Sets processed image colorspace on the fly.
virtual bool setResolution(const int &resolution)
Sets processed image resolution on the fly.
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.
void pause(const bool &paused)
Pause the extractor, without calling the stop method.
virtual void process(ALImage *img)=0
Method which will be called each time the extractor gets an image.
virtual bool setActiveCamera(const int &cameraId)
Sets the camera from which the image is taken.
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 void start()=0
Method which will be called before each subscription to the extractor.
int getMaximumPeriod()
This method overrides the method inherited from ALExtractor. It computes the maximum period from the ...
virtual ~ALVisionExtractor()
void setSubscriptionParameters(const std::vector< std::pair< int, int > > &parameters)
int getMinimumPeriod()
This method overrides the method inherited from ALExtractor. It computes the minimum period from the ...
const int kQVGA
virtual void stop()=0
Method which will be called when the module is unsubscribed.
virtual bool setFrameRate(const int &framerate)
Sets extractor framerate on the fly.
vision defines
const int kBGRColorSpace
handle image
ALVisionExtractor is a generic vision extractor.
void xUpdateParameters(const int pPeriod, const float pPrecision)