00001 #ifndef __CoherenceEnhancementDiff__ 00002 #define __CoherenceEnhancementDiff__ 00003 00004 00005 00028 #include <stdio.h> 00029 00030 #include "AnImage.hpp" 00031 #include "AbsRImageFilter.hpp" 00032 00033 class CoherenceEnhancementDiff : public AbsRImageFilter 00034 { 00035 protected: 00036 00037 RImage* I0; // origin image 00038 RImage* I; // current image 00039 00040 00041 int niterations; 00042 double tau; 00043 00044 // diffusion matrix 00045 RImage* a; 00046 RImage* b; 00047 RImage* c; 00048 00049 double sigma; // blurred image if used 00050 double c1; 00051 double c2; 00052 00053 double lambda1, lambda2; 00054 double cosAlpha, sinAlpha; 00055 00056 // structure matrix 00057 double rho; // blurred integration if used 00058 00059 double j11, j12, j22; 00060 double mu1, mu2; 00061 00062 protected: 00063 00064 virtual void precompute(); 00065 virtual double computeA(int x, int y, int i,int j); 00066 00067 virtual void operations(RImage& result); 00068 virtual void operations(AnImage& mask, RImage& result); 00069 00070 public: 00071 00072 CoherenceEnhancementDiff(int n=20, double dt=0.2, 00073 double sig=0.5, double arho=10.0, double ac1=0.001, double ac2=1.0); 00074 virtual ~CoherenceEnhancementDiff(){} 00075 00076 virtual void prepare(RImage* src); // used to globally maintain subimages avoiding cons 00077 virtual void clear(){ delete a; delete b; delete c; } 00078 00079 00080 virtual RImage* filter(RImage* src, RImage* dest=0); 00081 virtual RImage* selectedFilter(AnImage* mask, RImage* src, RImage* dest=0); 00082 00083 virtual void report(FILE* file){} 00084 }; 00085 00086 00087 #endif