00001 #ifndef _RGB_PcaOp_H 00002 #define _RGB_PcaOp_H 00003 00036 #include <stdio.h> 00037 00038 #include "AnImage.hpp" 00039 00040 #include "RImage.hpp" 00041 #include "Real3CImage.hpp" 00042 00043 class RGB_PcaOp 00044 { 00045 private: 00046 00047 int width, height; 00048 00049 double* meanChannel; 00050 double* covariance; 00051 00052 00053 double* eigenValue; 00054 double* triDiagonalCov; 00055 double* eigenVectors; 00056 00057 double* e; // temporary eigenvalue computation 00058 00059 protected: 00060 00061 void computePixelCovariance(AnImage* g); 00062 00063 void triDiagonalisation(); 00064 00065 // Public householder tridiagonalisation in C 00066 void tri_diag(double* a,double* d,double* e,double* z,int n,double tol); 00067 int calc_eigenstructure(double* d,double* e,double* z,int n,double macheps); 00068 00069 public: 00070 00071 RGB_PcaOp(); 00072 virtual ~RGB_PcaOp(); 00073 00074 // Default is principal component 00075 virtual RImage* singleFilter(AnImage* source, RImage* destination, int pcaChannel=0); 00076 // All channels recovered 00077 virtual Real3CImage* filter(AnImage* source, Real3CImage* destination); 00078 00079 virtual void report(FILE* file){} 00080 virtual void report(){} 00081 }; 00082 00083 #endif