00001 #ifndef __RCDDInpainter__ 00002 #define __RCDDInpainter__ 00003 00026 #include <stdio.h> 00027 00028 #include "RImage.hpp" 00029 #include "AbsRImageFilter.hpp" 00030 00031 class RCDDInpainter : public AbsRImageFilter 00032 { 00033 private: 00034 00035 bool optimisation; // use marquina multiplier 00036 00037 double dt; 00038 00039 RImage* I0; 00040 RImage* I; 00041 00042 RImage* guxNorme; // gradient norme S=1 00043 RImage* guyNorme; 00044 00045 // curvature computation 00046 double kX, kY, kNorme; 00047 double ux2, uy2, gu2Norme; 00048 double ux2Norme, uy2Norme; 00049 00050 protected: 00051 00052 void precompute(); 00053 00054 void computeGradient(int x, int y, int idx, int idy); 00055 void computeCurvature(int x, int y, int idx, int idy); 00056 00057 double g(double value); 00058 double getJ(int x, int y, int idx, int idy); 00059 00060 double divergentJ(int x, int y) 00061 { return ( getJ(x,y,1,0)-getJ(x,y,-1,0) + getJ(x,y,0,1)-getJ(x,y,0,-1) ); } 00062 00063 public: 00064 00065 RCDDInpainter(bool optimized=false, double deltaT=0.2); 00066 virtual ~RCDDInpainter(){} 00067 00068 virtual void prepare(RImage* src); // used to globally maintain subimages avoiding cons 00069 virtual void clear(){ delete guxNorme; delete guyNorme; } 00070 00071 // single shot filtering 00072 virtual RImage* filter(RImage* src, RImage* dest=0){ return 0; } 00073 virtual RImage* selectedFilter(AnImage* mask, RImage* src, RImage* dest=0); 00074 00075 virtual void report(FILE* file){ fprintf(file,"Real Bertalmio Inpainter\n"); } 00076 }; 00077 00078 00079 #endif