00001 #ifndef __CoherenceEnhancementDiff55__ 00002 #define __CoherenceEnhancementDiff55__ 00003 00027 #include <stdio.h> 00028 00029 #include "AnImage.hpp" 00030 #include "AbsRImageFilter.hpp" 00031 00032 class CoherenceEnhancementDiff55 : public AbsRImageFilter 00033 { 00034 protected: 00035 00036 RImage* I0; // origin image 00037 RImage* I; // current image 00038 00039 00040 int niterations; 00041 double tau; 00042 00043 AbsRImageFilter* opX; // gradX 00044 AbsRImageFilter* opY; // gradY 00045 00046 AbsRImageFilter* largeBlurrer; // used for structured tensors 00047 00048 RImage* ux; 00049 RImage* uy; 00050 00051 // diffusion matrix 00052 double a; 00053 double b; 00054 double c; 00055 00056 double sigma; // blurred image if used 00057 double c1; 00058 double c2; 00059 00060 double lambda1, lambda2; 00061 double cosAlpha, sinAlpha; 00062 00063 // structure matrix 00064 double rho; // blurred integration if used 00065 00066 RImage* jtmp; 00067 RImage* j11; 00068 RImage* j12; 00069 RImage* j22; 00070 00071 double mu1, mu2; 00072 00073 // flux 00074 RImage* j1; 00075 RImage* j2; 00076 RImage* j1x; 00077 RImage* j2y; 00078 00079 protected: 00080 00081 virtual void precompute(); 00082 00083 00084 virtual void operations(RImage& result); 00085 virtual void operations(AnImage& mask, RImage& result); 00086 00087 public: 00088 00089 CoherenceEnhancementDiff55(int n=100, double dt=0.2, 00090 double sig=0.5, double arho=5.0, double ac1=0.001, double ac2=1.0); 00091 virtual ~CoherenceEnhancementDiff55(){ delete largeBlurrer; } 00092 00093 virtual void prepare(RImage* src); // used to globally maintain subimages avoiding cons 00094 virtual void clear(){ delete ux; delete uy; delete j1; delete j2; delete j1x; delete j2y; } 00095 00096 virtual RImage* filter(RImage* src, RImage* dest=0); 00097 virtual RImage* selectedFilter(AnImage* mask, RImage* src, RImage* dest=0); 00098 00099 virtual void report(FILE* file){} 00100 }; 00101 00102 00103 #endif