00001 #ifndef __RegularisedPeronaFilter__ 00002 #define __RegularisedPeronaFilter__ 00003 00022 #include <stdio.h> 00023 00024 #include "AnImage.hpp" 00025 #include "AbsRImageFilter.hpp" 00026 00027 #include "BeltramiFlow.hpp" 00028 00029 class RegularisedPeronaFilter : public AbsRImageFilter 00030 { 00031 protected: 00032 00033 RImage* I0; // origin image 00034 RImage* I; // current image 00035 00036 double lambda; // used for linear constrains around the origin 00037 00038 int niterations; 00039 double alpha; 00040 00041 RImage* ux; 00042 RImage* uy; 00043 00044 RImage* j1; 00045 RImage* j2; 00046 00047 protected: 00048 00049 void precompute(); 00050 void precompute(AnImage& mask); 00051 00052 double divergentJ(int x, int y) 00053 { 00054 return (j1->dfX_0(x,y) + j2->dfY_0(x,y)); 00055 } 00056 00057 virtual void operations(RImage& result); 00058 virtual void operations(AnImage& mask, RImage& result); 00059 00060 public: 00061 00062 RegularisedPeronaFilter(int n=100, double ralpha=0.1, double rlambda=5.0); 00063 virtual ~RegularisedPeronaFilter(){} 00064 00065 00066 virtual RImage* filter(RImage* src, RImage* dest=0); 00067 virtual RImage* selectedFilter(AnImage* mask, RImage* src, RImage* dest=0); 00068 00069 virtual void report(FILE* file){} 00070 }; 00071 00072 00073 #endif