Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef __JAUS_EXTRAS_VIDEO_VISUAL_SENSOR__H
00041 #define __JAUS_EXTRAS_VIDEO_VISUAL_SENSOR__H
00042
00043 #include "jaus/core/events/events.h"
00044 #include "jaus/extras/video/reportimage.h"
00045 #include "jaus/extras/video/queryimage.h"
00046 #include <cxutils/images/image.h>
00047
00048 namespace JAUS
00049 {
00050 typedef CxUtils::Image Image;
00051 class SharedImage;
00052
00069 class JAUS_EXTRAS_DLL VisualSensor : public Events::Child
00070 {
00071 public:
00072 const static std::string Name;
00073
00074 VisualSensor(const bool sharedImage = true);
00075
00076 ~VisualSensor();
00077
00078 void SetCameraCount(const Byte cameraCount);
00079
00080 bool SetCurrentFrame(const unsigned char* rawImage,
00081 const unsigned int width,
00082 const unsigned int height,
00083 const unsigned char channels,
00084 const Byte cameraID,
00085 const unsigned int frameNumber,
00086 const double frameRateHz);
00087
00088 bool SetCurrentFrameCompressed(const unsigned char* compImage,
00089 const unsigned int compImageSize,
00090 const unsigned int width,
00091 const unsigned int height,
00092 const unsigned char channels,
00093 const Byte cameraID,
00094 const unsigned int frameNumber,
00095 const double frameRateHz,
00096 const Image::Format format);
00097
00098 bool SetCurrentFrame(const unsigned char* rawImage,
00099 const unsigned int width,
00100 const unsigned int height,
00101 const unsigned char channels,
00102 const Byte cameraID,
00103 const double frameRateHz);
00104
00105 virtual bool GenerateEvent(const Events::Subscription& info) const;
00106
00107 virtual bool IsEventSupported(const Events::Type type,
00108 const double requestedPeriodicRate,
00109 const Message* queryMessage,
00110 double& confirmedPeriodicRate,
00111 std::string& errorMessage) const;
00112
00113 virtual bool IsDiscoverable() const { return true; }
00114
00115 virtual void Receive(const Message* message);
00116
00117 virtual Message* CreateMessage(const UShort messageCode) const;
00118
00119 bool SetCompressionQualityJPEG(const int quality);
00120 private:
00121 Mutex mVisualSensorMutex;
00122 Byte mCameraCount;
00123 bool mSharedMemoryImageFlag;
00124 std::map<Byte, double> mFrameRates;
00125 std::map<Byte, ReportImage> mCompressedData;
00126 std::map<Byte, SharedImage*> mSharedImages;
00127 std::map<UShort, QueryImage> mPendingQueryMap;
00128 int mQualityJPEG;
00129 CxUtils::JPEG::Compressor mJPEG;
00130 };
00131 }
00132
00133 #endif
00134