00001
00028 #ifndef __VETLIB_VETFILTERCOLOR_H__
00029 #define __VETLIB_VETFILTERCOLOR_H__
00030
00031 #include "../vetDefs.h"
00032 #include "../vetFilter.h"
00033
00034 #include "../vetFrameYUV420.h"
00035 #include "../vetFrameRGB24.h"
00036 #include "../vetFrameT.h"
00037
00038
00039 class vetFilterColorParameters : public vetFilterParameters
00040 {
00041 public:
00042
00043 enum RUNMODE{ DO_NOTHING, SOLARIZE, POSTERIZE, CLAMP, INVERT, EXTRACTBITPLANE };
00044
00045 protected:
00046
00047 RUNMODE runMode;
00048
00049 unsigned int currBpp;
00050 unsigned int currBits;
00051
00052 friend class vetFilterColor;
00053
00054
00055 public:
00056
00057 vetFilterColorParameters(RUNMODE mode = vetFilterColorParameters::DO_NOTHING);
00058 ~vetFilterColorParameters() {}
00059
00060 void reset();
00061
00062 void setRunMode(RUNMODE mode) { runMode = mode; };
00063 RUNMODE getRunMode() { return runMode; };
00064
00065 void setWorkingBpp(unsigned int value) { currBpp = value; };
00066 unsigned int getWorkingBpp() { return currBpp; };
00067
00068 void setBitPlaneBits(unsigned int value) { currBits = value; };
00069 unsigned int getBitPlaneBits() { return currBits; };
00070
00071
00072 VETRESULT saveToStreamXML(FILE *fp);
00073 VETRESULT loadFromStreamXML(FILE *fp);
00074
00075 };
00076
00077
00078 class vetFilterColor : public vetFilter
00079 {
00080
00081 protected:
00082
00086 vetFilterColorParameters* myParams;
00087
00088 public:
00089
00090
00095 vetFilterColor( vetFilterColorParameters* initParams = NULL );
00096
00100 ~vetFilterColor();
00101
00102
00103 float getFrameRate() const { return 0; };
00104
00114 VETRESULT setParameters(vetFilterColorParameters* initParams);
00115
00121 vetFilterColorParameters& getParameters() { return *myParams; };
00122
00123
00133 VETRESULT setFilterParameters (vetFilterParameters* initParams)
00134 {
00135 if (initParams == NULL)
00136 return setParameters(NULL);
00137 else
00138 return setParameters(static_cast<vetFilterColorParameters*>(initParams));
00139 };
00140
00141
00142
00148 vetFilterParameters* getFilterParameters ()
00149 {
00150 if (myParams == NULL)
00151 return NULL;
00152 else
00153 return static_cast<vetFilterParameters*>(myParams);
00154 };
00155
00156
00162 VETRESULT reset();
00163
00164
00165
00166 VETRESULT clamp(vetFrameRGB24& img, unsigned int bpp);
00167 VETRESULT clamp(vetFrameYUV420& img, unsigned int bpp);
00168 VETRESULT clamp(vetFrameT<unsigned char>& img, unsigned int bpp);
00169
00170 VETRESULT invert(vetFrameRGB24& img, unsigned int bpp);
00171 VETRESULT invert(vetFrameYUV420& img, unsigned int bpp);
00172 VETRESULT invert(vetFrameT<unsigned char>& img, unsigned int bpp);
00173
00174 VETRESULT extractBitPlane(vetFrameRGB24& img, unsigned int bits = 1);
00175 VETRESULT extractBitPlane(vetFrameYUV420& img, unsigned int bits = 1);
00176 VETRESULT extractBitPlane(vetFrameT<unsigned char>& img, unsigned int bits = 1);
00177
00178
00179
00190 VETRESULT importFrom(vetFrameYUV420& img);
00191
00202 VETRESULT importFrom(vetFrameRGB24& img);
00203
00214 VETRESULT importFrom(vetFrameT<unsigned char>& img);
00215
00216
00217
00218 };
00219
00220
00221
00222 #endif //__VETLIB_VETFILTERCOLOR_H__
00223
00224