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