00001 #ifndef __PeronaFabFilter__ 00002 #define __PeronaFabFilter__ 00003 00025 #include <stdio.h> 00026 00027 #include "AnImage.hpp" 00028 #include "AbsRImageFilter.hpp" 00029 00030 #include "BeltramiFlow.hpp" 00031 00032 class PeronaFabFilter: public AbsRImageFilter 00033 { 00034 protected: 00035 00036 RImage* I0; // origin image 00037 RImage* I; // current image 00038 00039 double gsigma; // blurring of the gradient 00040 RImage* gradI0; // norm of gradient of I0 00041 00042 int nf; // order of (s/kf)^n 00043 double kf; // old lambda, used for linear constrains around the origin 00044 00045 00046 int nb; 00047 double alpha; // credit of backward diffusion 00048 double kb; // backward component 00049 double wb; // backward window 00050 00051 int niterations; 00052 double tau; 00053 00054 RImage* j1; 00055 RImage* j2; 00056 00057 protected: 00058 00059 virtual double g(int i, int j, double s); 00060 00061 virtual void precompute(); 00062 virtual void precompute(AnImage& mask); 00063 00064 virtual double divergentJ(int x, int y) 00065 { 00066 return (j1->dfX_0(x,y) + j2->dfY_0(x,y)); 00067 } 00068 00069 virtual void operations(RImage& result); 00070 virtual void operations(AnImage& mask, RImage& result); 00071 00072 public: 00073 00074 PeronaFabFilter(int n=16, double dt=0.1, 00075 int nf=4, int nb=2, double gSigma=3.0, double rkf=0.1, double rkb= 6.0, double rw=2.0); 00076 virtual ~PeronaFabFilter(){} 00077 00078 00079 virtual RImage* filter(RImage* src, RImage* dest=0); 00080 virtual RImage* selectedFilter(AnImage* mask, RImage* src, RImage* dest=0); 00081 00082 virtual void report(FILE* file){} 00083 }; 00084 00085 00086 #endif