libalvision
1.12
|
00001 00018 #pragma once 00019 #ifndef _LIBALVISION_ALVISION_ALVISIONEXTRACTOR_H_ 00020 #define _LIBALVISION_ALVISION_ALVISIONEXTRACTOR_H_ 00021 00022 // Upstream opencv headers need this 00023 #include <cstddef> 00024 00025 #include <alextractor/alextractor.h> 00026 #include <alcommon/alproxy.h> 00027 #include <alvision/alimage.h> 00028 00029 //opencv 00030 #include <opencv/cv.h> 00031 #include <opencv/highgui.h> 00032 #include <opencv/cvaux.h> 00033 00034 namespace AL 00035 { 00036 00037 class ALBroker; 00038 class ALMutex; 00039 class ALVideoDeviceProxy; 00040 class ALVisionExtractor: public ALExtractor 00041 { 00042 00043 public : 00049 ALVisionExtractor(boost::shared_ptr<ALBroker> pBroker, const std::string& pName ); 00050 00051 00055 virtual ~ALVisionExtractor(); 00056 00060 void init(void); 00061 00065 void run(); 00066 00067 00071 virtual void initVision(){}; 00072 00076 virtual void process(IplImage*) = 0; 00077 00078 00083 virtual std::vector<std::string> getOutputNames( ); 00084 00090 void setParam(const std::string ¶mName, const ALValue ¶mValue); 00091 00092 00096 void xInitGenericStuff(); 00097 00101 void xReleaseGenericStuff(); 00102 00103 00107 void xInitSpecificStuff(); 00108 00112 void xReleaseSpecificStuff(); 00113 00114 00115 00116 protected: 00121 virtual void xStartDetection( const int pPeriod , const float pPrecision ); 00122 00130 virtual void xUpdateParameters( const int pPeriod , const float pPrecision ); 00131 00136 void xStopDetection( ); 00137 00138 protected: 00139 boost::shared_ptr<AL::ALVideoDeviceProxy> xCamProxy; 00140 boost::shared_ptr<AL::ALProxy> xCamGenericProxy; 00141 std::string xGvmName; 00142 int xMode; 00143 int xResolution; 00144 int xColorSpace; 00145 int xImageWidth; 00146 int xImageHeight; 00147 int xImageNLayers; 00148 int xCurrentPeriod; 00149 int xPause; 00150 bool xRunOrder; 00151 bool xIsRunning; 00152 ALImage* xptr_ALImageRaw; 00153 IplImage* xptr_IplImageRaw; 00154 std::string xIplImageRawName; 00155 00156 private: 00157 const boost::shared_ptr<ALMutex> xMyMutex; 00158 }; 00159 00160 00161 } // namespace AL 00162 00163 00164 00165 #endif // _LIBALVISION_ALVISION_ALVISIONEXTRACTOR_H_ 00166