00001
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef IMAGE_RGB_H
00023 #define IMAGE_RGB_H
00024
00025 #include "PixelRGB.h"
00026 #include "ImageGrey.h"
00027 #include "ImageBase.h"
00028 #include "Histogram.h"
00029
00030 class ImageRGB : virtual public ImageBase
00037 {
00038 public:
00040 enum FieldSelector { RED, GREEN, BLUE };
00041
00042
00043
00044 PixelRGB *data;
00045
00046 public:
00047
00048
00050 ImageRGB(unsigned int width, unsigned int height);
00051
00053 ImageRGB(char *, FileFormat) ;
00054
00056 ImageRGB(ImageRGB&);
00057
00059 ImageRGB(ImageRGB&,
00060 unsigned int min_x,
00061 unsigned int min_y,
00062 unsigned int max_x,
00063 unsigned int max_y) ;
00064
00065 ~ImageRGB();
00066
00068 void set_pixel(unsigned int x, unsigned int y, PixelRGB p);
00069
00071 void set_rgb(unsigned int x, unsigned int y,
00072 int red, int green, int blue);
00073
00075 void set_field(unsigned int x, unsigned int y,
00076 FieldSelector, int value);
00077
00082 void get_pixel(unsigned int x, unsigned int y, PixelRGB& p);
00083
00085 int get_field(unsigned int x, unsigned int y,
00086 FieldSelector);
00087
00089 ImageRGB& clear(int = 0);
00090
00092 ImageRGB& clear(PixelRGB&);
00093
00095 ImageRGB& clear_field(FieldSelector, int = 0);
00096
00098 ImageRGB& copy(ImageRGB& img);
00099
00101 ImageRGB& copy(ImageRGB& img,
00102 unsigned int min_x,
00103 unsigned int min_y,
00104 unsigned int max_x,
00105 unsigned int max_y,
00106 unsigned int start_x,
00107 unsigned int start_y);
00108
00110 bool save(char *, FileFormat) ;
00111
00112
00113
00115 ImageRGB& operator = (ImageRGB& img)
00116 { return this->copy(img); }
00117
00118 bool draw_line(int x_start, int y_start,
00119 int x_end, int y_end,
00120 PixelRGB pix);
00121 bool draw_filled_circle(unsigned int centre_x,
00122 unsigned int centre_y,
00123 unsigned int radius,
00124 PixelRGB pix);
00125
00126 bool enhance_contrast() ;
00127
00128 void normalise_colourspace(int scale_factor) ;
00129
00130 void quick_grey_and_scale_down(unsigned int scale_fact,
00131 ImageGrey& img) ;
00132
00133
00134 void histogram_segment(Histogram &hist,
00135 float threshold,
00136 ImageRGB& result) ;
00137 void histogram_segment(Histogram &hist,
00138 float threshold,
00139 bool *result) ;
00140 };
00141
00142
00143 #endif // IMAGE_RGB_H