00001 #ifndef __IColorToGreyTranfertOp__ 00002 #define __IColorToGreyTranfertOp__ 00003 00004 00005 00024 #include "AnImageOp.hpp" 00025 #include "RColorRGBtoLab.hpp" 00026 00027 00028 class ColorTrArea 00029 { 00030 private: 00031 00032 int x,y; 00033 int w,h; 00034 00035 double luminance; 00036 double sigmaLuminance; 00037 00038 double alpha; 00039 double beta; 00040 00041 public: 00042 ColorTrArea(int x0, int y0, float luminanceC=0.0, float sigmaLuminanceC=0.0, int width=5) 00043 {x=x0; y=y0; w=h=width; luminance=luminanceC ; sigmaLuminance=sigmaLuminanceC;} 00044 virtual ~ColorTrArea(){} 00045 00046 void setChromacity(double a, double b){ alpha= a; beta= b;} 00047 00048 double getAlpha(){return alpha;} 00049 double getBeta(){return beta;} 00050 00051 virtual double getCost(){ return 0.5*(luminance + sigmaLuminance); } 00052 }; 00053 00054 class IColorToGreyTranfertOp : public AnImageOp 00055 { 00056 private: 00057 00058 RColorRGBtoLab rgbToLab; 00059 00060 double meanExample[3]; 00061 double sigmaExample[3]; 00062 00063 int nSourceAreas; 00064 int wSourceArea; 00065 00066 ColorTrArea** sourceArea; 00067 00068 public: 00069 00070 IColorToGreyTranfertOp(int sampleWidth=5){wSourceArea=sampleWidth;} 00071 virtual ~IColorToGreyTranfertOp(); 00072 00073 virtual void setReference(AnImage* example); 00074 00075 virtual AnImage* filter(AnImage* src, AnImage* dest=0); 00076 00077 virtual void report(FILE* file){} 00078 }; 00079 00080 00081 #endif