00001 #ifndef __RColorBilateralOp__ 00002 #define __RColorBilateralOp__ 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 RColorBilateralOp : public ARColorImageFilter 00041 { 00042 private: 00043 00044 int S; // window size from center 00045 00046 double sigmaD; // used for spatial diffusion 2,3,5 00047 double sigmaR; // used for measurement 10, 30, 100 00048 00049 double beta; // sigmaD/sigmaR used to reduce division 00050 00051 double beta2; // beta^2 00052 double invSigmaD2; // inverse variance diffusion 00053 00054 protected: 00055 00056 double getW(Real3CImage* im, int xc, int yc, int xn, int yn); 00057 00058 public: 00059 00060 RColorBilateralOp(double asigmaD=5.0, double asigmaR=30.0, int windowSize=15) 00061 {sigmaD= asigmaD; sigmaR= asigmaR; S=windowSize; 00062 beta= sigmaD/sigmaR; invSigmaD2= 1.0/(sigmaD*sigmaD); beta2= beta*beta;} 00063 virtual ~RColorBilateralOp(){} 00064 00065 00066 // single shot filtering 00067 virtual Real3CImage* filter(Real3CImage* src, Real3CImage* dest=0); 00068 virtual Real3CImage* selectedFilter(AnImage* mask, Real3CImage* src, Real3CImage* dest=0); 00069 00070 00071 00072 virtual void report(FILE* file){} 00073 }; 00074 00075 00076 #endif