00001 #ifndef __RColorCoherenceEnhBilateralOp__ 00002 #define __RColorCoherenceEnhBilateralOp__ 00003 00030 #include <stdio.h> 00031 00032 #include "AnImage.hpp" 00033 #include "RImage.hpp" 00034 00035 #include "Real3CImage.hpp" 00036 00037 #include "ARColorImageFilter.hpp" 00038 00039 00040 class RColorCoherenceEnhBilateralOp: public ARColorImageFilter 00041 { 00042 private: 00043 00044 double alpha; // to enhance an eigenvalue ]0.0, 1.0] 00045 double alphaInv; // to enhance an eigenvalue (avoid divisions) 00046 00047 int S; // window size from center 00048 00049 double sigmaD; // used for spatial diffusion 2,3,5 00050 double sigmaR; // used for measurement 10, 30, 100 00051 00052 double beta; // sigmaD/sigmaR used to reduce division 00053 00054 double beta2; // beta^2 00055 double invSigmaD2; // inverse variance diffusion 00056 00057 protected: 00058 00059 double getW(Real3CImage* im, int xc, int yc, int xn, int yn); 00060 00061 public: 00062 00063 RColorCoherenceEnhBilateralOp(double alpha0= 0.01, double asigmaD=5.0, double asigmaR=30.0, int windowSize=15) 00064 {alpha= alpha0; alphaInv= 1.0/alpha; sigmaD= asigmaD; sigmaR= asigmaR; S=windowSize; 00065 beta= sigmaD/sigmaR; invSigmaD2= 1.0/(sigmaD*sigmaD); beta2= beta*beta;} 00066 virtual ~RColorCoherenceEnhBilateralOp(){} 00067 00068 00069 // single shot filtering 00070 virtual Real3CImage* filter(Real3CImage* src, Real3CImage* dest=0); 00071 virtual Real3CImage* selectedFilter(AnImage* mask, Real3CImage* src, Real3CImage* dest=0); 00072 00073 00074 00075 virtual void report(FILE* file){} 00076 }; 00077 00078 00079 #endif