Wavelet and Image class library  1.3.2
ImageComparison.hh
Go to the documentation of this file.
00001 /*
00002  * class ImageComparison
00003  *
00004  * $Date$
00005  * $Revision$
00006  *
00007  */
00008 
00009 #ifndef IMAGE_COMPARISON_HH__
00010 #define IMAGE_COMPARISON_HH__
00011 
00012 #include "WImage/Image.hh"
00013 #include "Wave/Filter.hh"
00014 #include "WTools/ImageInformation.hh"
00015 
00021 typedef enum { DRAWN = 0, SCANNED } imgtype;
00022 
00024 typedef enum { PYRAMID = 0, STANDARD } decomp;
00025 
00027 typedef struct lq {
00029   double colors;
00031   double details;
00032 } lq;
00033 
00035 typedef struct logvals {
00036   int val;
00037   bool init;
00038 } logvals;
00039 
00043 class ImageComparison 
00044 {
00045 public:
00053   ImageComparison (const Image &img1, const Image &img2);
00055   ~ImageComparison (void);
00056 
00060   inline int rows (void) const { return m_ysize; }
00064   inline int cols (void) const { return m_xsize; }
00068   inline int size (void) const { return m_xysize; }
00069 
00079   Image *difference (coeff magnify = 1, bool reverse = false);
00080 
00085   double cmpsnr (void);
00086   
00091   double cmpmse (void);
00092   
00109   lq distlq (double percent, FilterSet &flt, imgtype type);
00110 
00125   double distlqd (double percent, FilterSet &flt, imgtype type);
00126 
00138   static Image *truncateForLq (const Image &image, double percent,
00139                                FilterSet &flt, const decomp t = STANDARD);
00153   static double calcLqDetailScore (const Image &truncated1,
00154                                    const Image &truncated2,
00155                                    int colorChannel = 0);
00169   static double calcLqAverageScore (const Image &truncated1,
00170                                     const Image &truncated2,
00171                                     int colorChannel = 0);
00183   static Image *truncateForLq (const Image &image, int nKeptCoeffs,
00184                                FilterSet &flt, const decomp t = STANDARD);
00197   static ImageInformation *imageInfoForLq (const Image &image, int nKeptCoeffs,
00198                                            FilterSet &flt, const decomp t = STANDARD);
00199 
00201 #define N_WEIGHTS 6
00202 
00209   static const float *getWeights (const imgtype imgType, int channel);
00210 
00211 protected:
00213   int m_ysize;
00215   int m_xsize;
00217   int m_xysize;
00218   
00220   Image *m_images[2];
00221   
00224   logvals * m_lqcache;
00225 
00228   double m_lqDWeights[2][N_WEIGHTS];
00229 
00231   static const float m_scWeights[][N_WEIGHTS];
00233   static const float m_drWeights[][N_WEIGHTS];
00234 
00236   int m_lqcachesize;
00237 
00244   int level (int pos);
00245 
00255   double weight (int y, int x, imgtype type);
00256   
00266   double lq_sum (imgtype type, bool reverse, bool oldLqd = false);
00267 };
00268 
00271 #endif // IMAGE_COMPARISON_HH__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines