00001 #ifndef __Perona1990Filter__ 00002 #define __Perona1990Filter__ 00003 00022 #include <stdio.h> 00023 00024 #include "AnImage.hpp" 00025 #include "AbsRImageFilter.hpp" 00026 00027 #include "BeltramiFlow.hpp" 00028 00029 class Perona1990Filter : 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* j1; 00042 RImage* j2; 00043 00044 protected: 00045 00046 void precompute(); 00047 void precompute(AnImage& mask); 00048 00049 double divergentJ(int x, int y) 00050 { 00051 return (j1->dfX_0(x,y) + j2->dfY_0(x,y)); 00052 } 00053 00054 virtual void operations(RImage& result); 00055 virtual void operations(AnImage& mask, RImage& result); 00056 00057 public: 00058 00059 Perona1990Filter(int n=100, double ralpha=0.1, double rlambda=5.0); 00060 virtual ~Perona1990Filter(){} 00061 00062 00063 virtual RImage* filter(RImage* src, RImage* dest=0); 00064 virtual RImage* selectedFilter(AnImage* mask, RImage* src, RImage* dest=0); 00065 00066 virtual void report(FILE* file){} 00067 }; 00068 00069 00070 #endif