00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _Matrix_image_h_
00028 #define _Matrix_image_h_
00029
00030 #include "matrix.h"
00031 #include "color.h"
00032
00035 namespace PLib {
00036
00047 template <class T>
00048 class MatrixImage : public Matrix<T> {
00049 public:
00050 MatrixImage(void) : Matrix<T>() {}
00051 MatrixImage(Matrix<T>& img): Matrix<T>(img) {}
00052 MatrixImage(MatrixImage<T>& img): Matrix<T>(img) {}
00053 MatrixImage(const int r, const int c): Matrix<T>(r,c) {}
00054 ~MatrixImage() {}
00055
00056 void drawLine(int i1, int j1, int i2, int j2, T color) ;
00057 void drawPoint(int i, int j, double radius, T color) ;
00058 void store(Matrix<T>&) ;
00059 };
00060
00061 }
00062
00063 typedef PLib::MatrixImage<unsigned char> Image_UBYTE ;
00064 typedef PLib::MatrixImage<char> Image_BYTE ;
00065 typedef PLib::MatrixImage<int> Image_INT ;
00066 typedef PLib::MatrixImage<double> Image_DOUBLE ;
00067 typedef PLib::MatrixImage<PLib::Color> Image_Color ;
00068
00069 #ifdef WITH_IMAGE_MAGICK
00070
00071 #include <magick/magick.h>
00072 #if defined(__cplusplus) || defined(c_plusplus)
00073 #undef class
00074 #endif
00075
00076 namespace PLib{
00077
00098 template <class T>
00099 class IM_ImageT: public MatrixImage<T> {
00100 public:
00101 IM_ImageT(const char *filename, int save=0);
00102 IM_ImageT() ;
00103 IM_ImageT(const int r, const int c) ;
00104 ~IM_ImageT() ;
00105
00106 int read(const char* filename) ;
00107 int write(const char* filename) ;
00108
00109
00110 void despeckle() { setImage() ; image=DespeckleImage(image); setMatrix() ;}
00111 void emboss() { setImage() ; image=EmbossImage(image) ; setMatrix() ;}
00112 void enhance() { setImage() ; image=EnhanceImage(image) ; setMatrix() ;}
00113 void blur(double b) { setImage() ; image=BlurImage(image,b) ; setMatrix() ;}
00114 void oilPaint(const unsigned int a) { setImage() ; image=OilPaintImage(image,a) ; setMatrix() ;}
00115
00116
00117 protected:
00118 char* file_name ;
00119 int autoSave ;
00120 Image *image ;
00121 ImageInfo image_info ;
00122
00123 void setImage() ;
00124 void setMatrix() ;
00125 };
00126
00127 }
00128
00129 typedef PLib::IM_ImageT<unsigned char> IM_Image ;
00130 typedef PLib::IM_ImageT<PLib::Color> IM_ColorImage ;
00131
00132 #endif // WITH_IMAGE_MAGICK
00133
00134 #ifdef INCLUDE_TEMPLATE_SOURCE
00135 #include "image.cpp"
00136 #endif
00137
00138
00139 #endif