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