00001 00004 #ifndef __VERTEX_DATA_COLOR_HH__ 00005 #define __VERTEX_DATA_COLOR_HH__ 00006 00007 #include <tab_ptr.hh> 00008 #include <image.hh> 00009 #include <quantize.hh> 00010 #include <string.h> 00011 #include "vertex_data.hh" 00012 00014 class vertex_data_color: public vertex_data 00015 { 00016 private: 00017 // Array of pointor on the vertex value 00018 tab_ptr data; 00019 // Pointor on the picture that will be used to initialize the vertex_value 00020 image *img; 00021 // Pointor on the quantizer of the picture 00022 quantize *quant; 00023 00024 public: 00026 vertex_data_color(image &I,quantize &Q); 00028 virtual ~vertex_data_color(); 00029 00031 class vertex_value 00032 { 00033 private: 00034 // Sum of the color of all the vertices which were merged to the vertex 00035 double M1[3]; 00036 // Sum of the squar of the color of all the vertices which were merged to the vertex 00037 double M2[3]; 00038 // boolean that show the state of the vertex 00039 bool merged; 00040 // perimeter of the area describe by the vertex 00041 int perimetre; 00042 // Number of the vertices which were merged to the vertex 00043 int cardinal; 00044 00045 public: 00047 vertex_value(); 00049 vertex_value(const vertex_value &); 00051 vertex_value(int *, int); 00053 ~vertex_value() 00054 {} 00055 00057 vertex_value & operator=(const vertex_value &); 00060 vertex_value reinit(double*,double*,int,int,int); 00061 00063 void give_color(double *); 00065 void give_squared_color(double *); 00067 int give_cardinal(); 00069 void give_mean(double*); 00071 double give_variance(); 00073 double give_se(); 00075 int give_perimetre(); 00077 int add_perimetre(int); 00078 }; 00079 00080 00082 vertex_value &operator() (long) const; 00084 void del(vertex); 00085 00087 void init(combi_map_base &,vertex); 00089 void merge(int,vertex,vertex); 00090 00092 int give_label(vertex); 00094 int give_dim_color(); 00095 }; 00096 00097 #endif // __VERTEX_DATA_COLOR_HH__