Main Page | Class Hierarchy | Class List | File List | Class Members

image.h

00001 /*=============================================================================
00002         File: image.h
00003      Purpose: To add some basic image processing capabilities to the 
00004               matrix class
00005     Revision: $Id: image.h,v 1.2 2002/05/13 21:07:45 philosophil Exp $
00006   Created by: Philippe Lavoie          (3 Oct, 1996)
00007  Modified by: 
00008 
00009  Copyright notice:
00010           Copyright (C) 1996-1998 Philippe Lavoie
00011  
00012           This library is free software; you can redistribute it and/or
00013           modify it under the terms of the GNU Library General Public
00014           License as published by the Free Software Foundation; either
00015           version 2 of the License, or (at your option) any later version.
00016  
00017           This library is distributed in the hope that it will be useful,
00018           but WITHOUT ANY WARRANTY; without even the implied warranty of
00019           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020           Library General Public License for more details.
00021  
00022           You should have received a copy of the GNU Library General Public
00023           License along with this library; if not, write to the Free
00024           Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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 } // end namespace
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       //Image processing functions offered by ImageMagick
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 } // end namespace
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 

Generated on Mon Dec 29 08:25:10 2003 for NURBS++ by doxygen 1.3.4