Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

Copie de FImage.hpp

00001 #ifndef __FImage__
00002 #define __FImage__
00003 
00004 
00005 
00024 #include <stdio.h>
00025 #include <math.h>
00026 #include <memory.h>
00027 
00028 #include "AnImage.hpp"
00029 
00030 class FImage 
00031 {
00032 private:
00033         
00034 bool            normalisation;          // 0..1 range
00035 int             width;
00036 int                     height;
00037 
00038 int                     channel;
00039 
00040 
00041 float*          p1;
00042 float** data;
00043 
00044 double          PI;
00045 
00046 
00047 public:
00048 
00049 FImage( int w, int h );
00050 FImage( int w, int h , float value);
00051 FImage( AnImage* source );
00052 FImage( AnImage* source , int achannel );
00053 FImage( AnImage* source, bool normalized );
00054 FImage( FImage& im);                                                            // copy
00055 
00056 ~FImage(){ delete[] data; delete[] p1; }
00057 
00058 FImage* copy();
00059 FImage* scaleDown(int multiplier=2);
00060 
00061 float* getData(){return p1;}
00062 
00063 void    set(FImage& im); 
00064 void    set(FImage& im, int n, int* xp, int* yp);
00065 
00066 bool isNormalized(){ return normalisation; }
00067 inline int getWidth(){ return width; }
00068 inline int getHeight(){ return height; }
00069 
00070 
00071 inline float    get(int x, int y){ return data[x][y]; }
00072 inline void     set(int x,int y, float value){ data[x][y]= value; }
00073 
00074 float   getSafe(int x, int y);
00075 void    setSafe(int x,int y, float value);
00076 
00077 void    gdistance1( float value );
00078 void    gdistance2( float value );
00079 
00080 // compute simple operations
00081 
00082 void    operator*=( float value );
00083 void    operator/=( float value );
00084 void    operator+=( float value );
00085 void    operator-=( float value );
00086 
00087 void    operator+=( FImage& image );
00088 void    operator-=( FImage& image );
00089 
00090 void    mult( float rsat );
00091 void    limit( float rmin, float rmax );
00092 
00093 void    convolveHV(int m1, int m2, int m3);                     // near inplace
00094 
00095 void    inverse(float biais=0.0000001);
00096 void    ln(float biais=1.0);
00097 void    exp();
00098 void    root();
00099 void    sqr();
00100 void    power(float value);
00101 
00102 float   laplacian(int x, int y);
00103 float   isometricLaplacian(int x, int y);
00104 float   normeGradient(int x, int y, float epsilon=1e-8);
00105 
00106 
00107 float   meanCurvature(int x, int y);
00108 float   curvature(int x, int y);
00109 
00110 float   gij(int i, int j, int x, int y);
00111 float   lambdaPlus(int x,int y);
00112 float   lambdaMinus(int x,int y);
00113 float   normalDirection(int x, int y);
00114 float   tangentDirection(int x, int y){ return (normalDirection(x,y)+PI/2.0); }
00115 
00116 // central differences
00117 float dfX_0(int x, int y);
00118 float dfY_0(int x, int y);
00119 
00120 float dfX_0_div2(int x, int y, int idx, int idy);                       // step demi    by averaging
00121 float dfY_0_div2(int x, int y, int idx, int idy);
00122 
00123 float dfX_0_div2MinMod(int x, int y, int idx, int idy); // step demi    by minmod
00124 float dfY_0_div2MinMod(int x, int y, int idx, int idy);
00125 
00126 float dfX_0_2(int x, int y);                                                            // step 2
00127 float dfY_0_2(int x, int y);
00128 
00129 // oriented differences
00130 float dfX_p1(int x, int y);
00131 float dfY_p1(int x, int y);
00132 float dfX_m1(int x, int y);
00133 float dfY_m1(int x, int y);
00134 
00135 // second differential
00136 float dfX2(int x, int y);
00137 float dfY2(int x, int y);
00138 float dfXY(int x, int y);
00139 float dfXYc(int x, int y);
00140 
00141 float dfX2_2(int x, int y);             // step 2
00142 float dfY2_2(int x, int y);
00143 float dfXY_2(int x, int y);
00144 
00145 // third differential
00146 float dfX3(int x, int y);
00147 float dfY3(int x, int y);
00148 
00149 
00150 // derivee 1 along normal
00151 float In(int x, int y);
00152 
00153 // derivee 2 along normal
00154 float Inn(int x, int y);
00155 
00156 // derivee 2 along tangent
00157 float Iee(int x, int y);
00158 
00159 // general diff operators
00160 float g(int x, int y, int p=1);
00161 
00162 float peronaMalikOperator(int x, int y);
00163 float meanCurvatureOperator(int x, int y);
00164 float beltramiOperator(int x, int y);
00165 
00166 float gradCorrectiveViscosity(int x, int y);
00167 
00168 void peronaMalikOperation(FImage& image, float coefficient);
00169 void peronaMalikRestoration(int nIterations, float coefficient);
00170 
00171 void geodesicPeronaMalikOperation(FImage& image, float coefficient, float cgeod);
00172 void geodesicPeronaMalikRestoration(int nIterations, float coefficient, float cgeod);
00173 
00174 void meanCurvatureOperation(FImage& image, float coefficient);
00175 void meanCurvatureRestoration(int nIterations, float coefficient);
00176 
00177 void geodesicMeanCurvatureOperation(FImage& image, float coefficient, float cgeod);
00178 void geodesicMeanCurvatureRestoration(int nIterations, float coefficient, float cgeod);
00179 
00180 void beltramiOperation(FImage& image, float coefficient);
00181 void beltramiRestoration(int nIterations, float coefficient);
00182 
00183 void geodesicBeltramiOperation(FImage& image, float coefficient, float cgeod);
00184 void geodesicBeltramiRestoration(int nIterations, float coefficient, float cgeod);
00185 };
00186 
00187 #endif
SourceForge.net Logo
Restoreinpaint sourceforge project `C++/Java Image Processing, Restoration, Inpainting Project'.

Bernard De Cuyper: Open Project Leader: Concept, design and development.
Bernard De Cuyper & Eddy Fraiha 2002, 2003. Bernard De Cuyper 2004. Open and free, for friendly usage only.
Modifications on Belgium ground of this piece of artistic work, by governement institutions or companies, must be notified to Bernard De Cuyper.
bern_bdc@hotmail.com