00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef IMAGE_GREY_H
00023 #define IMAGE_GREY_H
00024
00025 #include "ImageBase.h"
00026 #include <CMatrix.h>
00027 #include <Wavelet.h>
00028
00030 typedef int PixelGrey;
00031
00033 struct equivalence {int eq1;
00034 int eq2;
00035 equivalence *next;
00036 };
00037
00038
00039 class ImageGrey : virtual public ImageBase
00046 {
00047 public:
00048 PixelGrey *brightness;
00049
00050 public:
00051
00052
00053
00055 ImageGrey(unsigned int width, unsigned int height);
00056
00058 ImageGrey(char *, FileFormat) ;
00059
00060 ImageGrey(ImageGrey&);
00061
00062 ImageGrey(ImageGrey& img,
00063 unsigned int min_x,
00064 unsigned int min_y,
00065 unsigned int max_x,
00066 unsigned int max_y) ;
00067
00068
00069 ~ImageGrey();
00070
00072 void set_pixel(unsigned int x, unsigned int y,
00073 PixelGrey level);
00074
00078 void get_pixel(unsigned int x, unsigned int y,
00079 PixelGrey& p);
00080
00082 ImageGrey& clear(int = 0);
00083
00085 ImageGrey& copy(ImageGrey& img);
00086
00088 ImageGrey& copy(ImageGrey& img,
00089 unsigned int min_x,
00090 unsigned int min_y,
00091 unsigned int max_x,
00092 unsigned int max_y,
00093 unsigned int start_x,
00094 unsigned int start_y);
00095
00096
00097
00099 void absolute() ;
00100
00102 void threshold(int thresh) ;
00103
00105 bool save(char *, FileFormat) ;
00106
00107
00108
00110 ImageGrey& operator = (ImageGrey& img)
00111 { return this->copy(img); }
00112
00114 ImageGrey& operator -= (ImageGrey& img) ;
00115
00117 ImageGrey& operator += (int fact) ;
00118
00120 ImageGrey& operator -= (int fact) ;
00121
00123 ImageGrey& operator /= (int fact) ;
00124
00126 ImageGrey& operator *= (int fact) ;
00127
00128 bool draw_line(int x_start, int y_start,
00129 int x_end, int y_end,
00130 PixelGrey intensity);
00131 bool draw_filled_circle(unsigned int centre_x,
00132 unsigned int centre_y,
00133 unsigned int radius,
00134 PixelGrey intensity);
00135 void scale_down(unsigned int min_x,
00136 unsigned int min_y,
00137 unsigned int max_x,
00138 unsigned int max_y,
00139 unsigned int new_sx,
00140 unsigned int new_sy,
00141 float *new_image);
00142 void scale_down(unsigned int min_x,
00143 unsigned int min_y,
00144 unsigned int max_x,
00145 unsigned int max_y,
00146 unsigned int new_sx,
00147 unsigned int new_sy,
00148 double *new_image);
00149 void quick_scale_down(unsigned int min_x,
00150 unsigned int min_y,
00151 unsigned int max_x,
00152 unsigned int max_y,
00153 unsigned int new_sx,
00154 unsigned int new_sy,
00155 double *new_image);
00156
00157
00158
00162 float convolve(unsigned int x,
00163 unsigned int y,
00164 CMatrix *conv_matrix) ;
00165 void plot_conv_kernel(unsigned int x,
00166 unsigned int y,
00167 CMatrix *conv_matrix,
00168 float scale_fact,
00169 float offset) ;
00170 float wavelet_convolve(unsigned int x,
00171 unsigned int y,
00172 Wavelet *wavelet,
00173 float *real,
00174 float *imag) ;
00175
00176 void blur(unsigned int size, ImageGrey &result) ;
00177
00178
00179
00180 bool sobel_horizontal(ImageGrey &result) ;
00181 bool sobel_vertical(ImageGrey &result) ;
00182 bool sobel(ImageGrey &result) ;
00183
00184
00185 bool median(unsigned int n, unsigned int m,
00186 ImageGrey &result) ;
00187
00188
00189
00190 bool dilate(ImageGrey &result) ;
00191 bool erode(ImageGrey &result) ;
00192 bool errode(ImageGrey &result) ;
00193
00194 bool remove_point_noise(ImageGrey &result) ;
00195
00196
00197
00198
00199 bool region_identify(unsigned int max_regions,
00200 unsigned int &actual_regions,
00201 ImageGrey &result) ;
00202 bool extract_region(int, ImageGrey &result);
00203
00204
00205
00206 void normalise_intensity(float mean,
00207 float sd) ;
00208 void normalise_intensity_range() ;
00209
00210
00211
00212 private:
00213
00214 bool new_equivalence(int low, int high,
00215 equivalence **latest) ;
00216 void free_equivalence(equivalence **eq) ;
00217
00218 };
00219
00220
00221 #endif // IMAGE_GREY_H