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

Float3CImage.hpp

00001 #ifndef __Float3CImage__
00002 #define __Float3CImage__
00003 
00004 
00005 
00024 #include <stdio.h>
00025 #include <math.h>
00026 #include <memory.h>
00027 
00028 #include "FImage.hpp"
00029 
00030 class Float3CImage 
00031 {
00032 private:
00033         
00034 bool            normalisation;          // 0..1 range
00035 int             width;
00036 int             height;
00037 
00038 FImage*         channel[3];
00039 
00040 float           PI;
00041 
00042 public:
00043 
00044 Float3CImage( int w, int h , float value=0);
00045 Float3CImage( int w, int h , float c1, float c2, float c3);
00046 Float3CImage( AnImage* source );                                                // RGB
00047 Float3CImage( AnImage* source , int achannel );
00048 Float3CImage( AnImage* source, bool normalized );
00049 Float3CImage(   Float3CImage& im);                                                              // copy
00050 
00051 ~Float3CImage();
00052 
00053 Float3CImage* copy();
00054 
00055 int             getChannels(){ return 3; }
00056 
00057 void    setInZeroOneBox(float minVal=0.0, float maxVal=255.0)
00058         { 
00059         for(int i=0; i<3; i++) 
00060                 channel[i]->setInZeroOneBox(minVal, maxVal); 
00061         }
00062 
00063 void    setOutZeroOneBox(float minVal=0.0, float maxVal=255.0)
00064         { 
00065         for(int i=0; i<3; i++) 
00066                 channel[i]->setOutZeroOneBox(minVal, maxVal); 
00067         }
00068 
00069 FImage* getChannel(int i){ return channel[i]; }
00070 void    setChannel(int i, FImage* image){ channel[i]= image; }
00071 
00072 float* getData(int i){return channel[i]->getData();}
00073 
00074 void    set(Float3CImage& im); 
00075 
00076 bool    isNormalized(){ return normalisation; }
00077 int             getWidth(){ return width; }
00078 int             getHeight(){ return height; }
00079 int             numberOfChannels(){ return 3; }
00080 
00081 float   get(int ch, int x, int y){ return channel[ch]->get(x,y); }
00082 void    set(int ch, int x,int y, float value){ channel[ch]->set(x,y,value); }
00083 
00084 // compute simple operations
00085 
00086 void    operator*=( float value );
00087 void    operator/=( float value );
00088 void    operator+=( float value );
00089 void    operator-=( float value );
00090 
00091 void    operator+=( Float3CImage& image );
00092 void    operator-=( Float3CImage& image );
00093 
00094 void    mult( float rsat );
00095 
00096 void    inverse(float biais=0.0000001);
00097 void    ln(float biais=1.0);
00098 void    exp();
00099 void    root();
00100 void    sqr();
00101 void    power(float value);
00102 
00103 float   laplacian(int ch, int x, int y)
00104                         { return channel[ch]->laplacian(x, y); }
00105 float   isometricLaplacian(int ch, int x, int y)
00106                         { return channel[ch]->isometricLaplacian(x, y); }
00107 float   normeGradient(int ch, int x, int y, float epsilon=1e-8)
00108                         { return channel[ch]->normeGradient(x, y, epsilon); }
00109 
00110 float   meanCurvature(int ch, int x, int y)
00111                         { return channel[ch]->meanCurvature(x, y); }
00112 float   curvature(int ch, int x, int y)
00113                         { return channel[ch]->curvature(x, y); }
00114 
00115 // global computation
00116 float   gij(int i, int j, int x, int y);
00117 float   lambdaPlus(int x,int y);
00118 float   lambdaMinus(int x,int y);
00119 float   normalDirection(int x, int y);
00120 float   tangentDirection(int x, int y){ return (normalDirection(x,y)+PI/2.0); }
00121 
00122 float   g(int ch, int x, int y) 
00123                 { return channel[ch]->g(x, y); }
00124 
00125 float   peronaMalikOperator(int ch, int x, int y)       
00126                 { return channel[ch]->peronaMalikOperator(x, y); }
00127 
00128 float   meanCurvatureOperator(int ch, int x, int y)     
00129                 { return channel[ch]->meanCurvatureOperator(x, y); }
00130 
00131 float   beltramiOperator(int ch, int x, int y)  
00132                 { return channel[ch]->beltramiOperator(x, y); }
00133 
00134 float gradCorrectiveViscosity(int ch, int x, int y)     
00135                 { return channel[ch]->gradCorrectiveViscosity(x, y); }
00136 
00137 // central differences
00138 float dfX_0(int ch, int x, int y){ return channel[ch]->dfX_0(x, y); }
00139 float dfY_0(int ch, int x, int y){ return channel[ch]->dfY_0(x, y); }
00140 
00141 float dfX_0_2(int ch, int x, int y){ return channel[ch]->dfX_0_2(x, y); }
00142 float dfY_0_2(int ch, int x, int y){ return channel[ch]->dfY_0_2(x, y); }
00143 
00144 // oriented differences
00145 float dfX_p1(int ch, int x, int y){ return channel[ch]->dfX_p1(x, y); }
00146 float dfY_p1(int ch, int x, int y){ return channel[ch]->dfY_p1(x, y); }
00147 float dfX_m1(int ch, int x, int y){ return channel[ch]->dfX_m1(x, y); }
00148 float dfY_m1(int ch, int x, int y){ return channel[ch]->dfY_m1(x, y); }
00149 
00150 // second differential
00151 float dfX2(int ch, int x, int y){ return channel[ch]->dfX2(x, y); }
00152 float dfY2(int ch, int x, int y){ return channel[ch]->dfY2(x, y); }
00153 float dfXY(int ch, int x, int y){ return channel[ch]->dfXY(x, y); }
00154 
00155 float dfX2_2(int ch, int x, int y){ return channel[ch]->dfX2_2(x, y); }
00156 float dfY2_2(int ch, int x, int y){ return channel[ch]->dfY2_2(x, y); }
00157 float dfXY_2(int ch, int x, int y){ return channel[ch]->dfXY_2(x, y); }
00158 };
00159 
00160 #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