[Wavelet-commit] Wavelet/WImage ColorBuffer.hh, 1.6, 1.7 ColorImage.hh, 1.5, 1.6 Image.hh, 1.15, 1
Status: Beta
Brought to you by:
herbert
From: Herbert M. D. <he...@us...> - 2007-08-07 17:01:06
|
Update of /cvsroot/wavelet/Wavelet/WImage In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6566/WImage Modified Files: ColorBuffer.hh ColorImage.hh Image.hh ImageVector.hh JpgReader.hh PixmapFile.hh PixmapReader.hh ReferenceVector.hh miscdefs.h Log Message: Various bugfixes, added ImageResizer tool class which allows smart cropping of color images (not very sophisticated yet). Index: ImageVector.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage/ImageVector.hh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ImageVector.hh 12 Jul 2005 14:52:18 -0000 1.3 --- ImageVector.hh 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 14,32 **** #include "WImage/ReferenceVector.hh" ! /** ! * @addtogroup WImage * @{ */ ! /** * Pseudo-vector (abstract) for use with two-dimensional objects, like ! * images. Provide a two-dimensional array's rows and columns as * vectors with array addressing. */ /*abstract*/ ! class ImageVector : public ReferenceVector { public: ! /** Constructor. Sets the array reference. */ ImageVector (ImageArray<coeff> *ar); --- 14,32 ---- #include "WImage/ReferenceVector.hh" ! /** ! * @addtogroup WImage * @{ */ ! /** * Pseudo-vector (abstract) for use with two-dimensional objects, like ! * images. Provide a two-dimensional array's rows and columns as * vectors with array addressing. */ /*abstract*/ ! class ImageVector : public ReferenceVector { public: ! /** Constructor. Sets the array reference. */ ImageVector (ImageArray<coeff> *ar); *************** *** 40,45 **** * the array has been resized. */ virtual void update (void); ! ! /** Set new root. Depending of what concrete instance is the current * row or col will be set. * @exception invalid_argument --- 40,45 ---- * the array has been resized. */ virtual void update (void); ! ! /** Set new root. Depending of what concrete instance is the current * row or col will be set. * @exception invalid_argument *************** *** 49,53 **** virtual void go (int root); ! /** Return a value (abstract). The value is taken from the vector's * position {\em pos}. * @param pos --- 49,53 ---- virtual void go (int root); ! /** Return a value (abstract). The value is taken from the vector's * position {\em pos}. * @param pos *************** *** 57,61 **** virtual coeff at (int pos) = 0; ! /** Assign a value (abstract). A new value {\em val} is assigned to * the vector's position {\em pos}. * @param pos --- 57,61 ---- virtual coeff at (int pos) = 0; ! /** Assign a value (abstract). A new value {\em val} is assigned to * the vector's position {\em pos}. * @param pos *************** *** 66,75 **** /** Return the vector's size (abstract). Depending on the concrete * instance we will get the associated array's number of rows or cols. ! * @return * the vector's size */ virtual int size (void) = 0; protected: ! /** A reference to encapsuled array. Rows and cols will be taken from * this array. */ ImageArray<coeff> *m_array; --- 66,80 ---- /** Return the vector's size (abstract). Depending on the concrete * instance we will get the associated array's number of rows or cols. ! * @return * the vector's size */ virtual int size (void) = 0; + /** + * Return the sum of the vector's absolute values + * @return the sum of the vector's absolute values + */ + coeff weight(void); protected: ! /** A reference to encapsuled array. Rows and cols will be taken from * this array. */ ImageArray<coeff> *m_array; *************** *** 78,82 **** /** The encapsulated array's rows . */ int m_ysize; ! }; /* class ImageVector */ --- 83,87 ---- /** The encapsulated array's rows . */ int m_ysize; ! }; /* class ImageVector */ Index: JpgReader.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage/JpgReader.hh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JpgReader.hh 12 Jul 2005 14:52:18 -0000 1.3 --- JpgReader.hh 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 12,17 **** #include "WImage/PixmapReader.hh" ! /** ! * @addtogroup WImage * @{ */ --- 12,17 ---- #include "WImage/PixmapReader.hh" ! /** ! * @addtogroup WImage * @{ */ *************** *** 21,30 **** * BUGS: Only color depths of 1 and 3 are supported. */ ! class JpgReader: public PixmapReader { public: /** Constructor. Only calls the mother class' constructor to initialize ! * the {\em ImageArray} reference. * @param name * the file name --- 21,30 ---- * BUGS: Only color depths of 1 and 3 are supported. */ ! class JpgReader: public PixmapReader { public: /** Constructor. Only calls the mother class' constructor to initialize ! * the {\em ImageArray} reference. * @param name * the file name *************** *** 37,41 **** /** Read the JPG file format. This does the actual work of reading and * parsing the image file. It gets called by the {\em read ()} method. ! * @return * 0 if successful, -1 on read error, -2 on file format error. */ virtual int readfmt (void); --- 37,41 ---- /** Read the JPG file format. This does the actual work of reading and * parsing the image file. It gets called by the {\em read ()} method. ! * @return * 0 if successful, -1 on read error, -2 on file format error. */ virtual int readfmt (void); Index: PixmapReader.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage/PixmapReader.hh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PixmapReader.hh 15 Aug 2005 16:24:23 -0000 1.4 --- PixmapReader.hh 7 Aug 2007 17:01:00 -0000 1.5 *************** *** 13,39 **** #include <fstream> ! /** ! * @addtogroup WImage * @{ */ /** ! * An abstract color image reader. The image is being read putting its ! * color channels into separate greyscale image objects. */ /*abstract*/ ! class PixmapReader: public PixmapFile { public: ! /** Constructor. Only calls the mother class' constructor to initialize ! * the {\em ImageArray} reference. * @param name * the file name * @param images ! * the array of greyscale images for the values * @param channels * the number of colors */ ! PixmapReader (char const *name, Image *images[], int channels) : PixmapFile (name, images, channels) {} --- 13,39 ---- #include <fstream> ! /** ! * @addtogroup WImage * @{ */ /** ! * An abstract color image reader. The image is being read putting its ! * color channels into separate greyscale image objects. */ /*abstract*/ ! class PixmapReader: public PixmapFile { public: ! /** Constructor. Only calls the mother class' constructor to initialize ! * the {\em ImageArray} reference. * @param name * the file name * @param images ! * the array of greyscale images for the values * @param channels * the number of colors */ ! PixmapReader (char const *name, Image *images[], int channels) : PixmapFile (name, images, channels) {} *************** *** 41,61 **** virtual ~PixmapReader (void) {} ! /** Read the image. All steps independent of the file format will be ! * performed, like testing for file readability etc. * @exception invalid_argument * invalid file format * @exception ios_base::failure ! * a read error has occured [not supported by all libraries, so eventually * {\em invalid_argument} instead] */ virtual void read (void); protected: ! /** Read different file formats (abstract). This is the method to be * implemented for every image file format. It will be called by the ! * {\em read ()} method. ! * @return * 0 if successful, -1 on read error, -2 on file format error. */ virtual int readfmt (void) = 0; ! }; /* class PixmapReader */ --- 41,61 ---- virtual ~PixmapReader (void) {} ! /** Read the image. All steps independent of the file format will be ! * performed, like testing for file readability etc. * @exception invalid_argument * invalid file format * @exception ios_base::failure ! * a read error has occured [not supported by all libraries, so eventually * {\em invalid_argument} instead] */ virtual void read (void); protected: ! /** Read different file formats (abstract). This is the method to be * implemented for every image file format. It will be called by the ! * {\em read ()} method. ! * @return * 0 if successful, -1 on read error, -2 on file format error. */ virtual int readfmt (void) = 0; ! }; /* class PixmapReader */ Index: ColorImage.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage/ColorImage.hh,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ColorImage.hh 12 Jul 2005 14:52:18 -0000 1.5 --- ColorImage.hh 7 Aug 2007 17:01:00 -0000 1.6 *************** *** 13,18 **** #include "WImage/ColorBuffer.hh" ! /** ! * @addtogroup WImage * @{ */ --- 13,18 ---- #include "WImage/ColorBuffer.hh" ! /** ! * @addtogroup WImage * @{ */ *************** *** 22,26 **** * such as PPM. The color models can be changed (RGB or YUV). */ ! class ColorImage : public ColorBuffer { --- 22,26 ---- * such as PPM. The color models can be changed (RGB or YUV). */ ! class ColorImage : public ColorBuffer { *************** *** 28,41 **** /** Constructor. Creates objects and sets actual start values. * @param colors ! * the number of colors, and therefore the array's length ! * @param cmodel * the color model * @param images ! * an array of {\em colors} images to copy the channel data from ! * @param isReference * if true, only references to the images will be copied, and they will ! * not be deleted at object destruction */ ! ColorImage (int colors = 3, clrmodel cmodel = cm_rgb, ! Image **images = NULL, bool isReference = false); /** Destructor. Frees allocated objects. */ virtual ~ColorImage (void); --- 28,45 ---- /** Constructor. Creates objects and sets actual start values. * @param colors ! * the number of colors, and therefore the array's length ! * @param cmodel * the color model * @param images ! * an array of {\em colors} images to copy the channel data from ! * @param ownership * if true, only references to the images will be copied, and they will ! * not be deleted at object destruction, else the images will be cloned ! * and destroyed in the end ! * @param isMine if true the incoming images will not be cloned, i.e. ! * ownership is transferred to this color image */ ! ColorImage (int colors = 3, clrmodel cmodel = cm_rgb, ! Image **images = NULL, bool isReference = false, ! bool isMine = false); /** Destructor. Frees allocated objects. */ virtual ~ColorImage (void); *************** *** 47,61 **** * @return the color channel as a reference to an Image object */ inline Image &channel (int num) { return *m_images[num]; } ! #ifndef _WIN32_WCE ! /** Read the image. All steps independent of the file format will be ! * performed, like testing for file readability etc. * @exception invalid_argument * invalid file format * @exception ios_base::failure ! * a read error has occured [not supported by all libraries, so eventually * {\em invalid_argument} instead] */ void read (char const *fname); ! /** Read an image. Reads an image from a file using the specified * file type. Currently PGM, RAW and PFI are supported. * @exception invalid_argument --- 51,65 ---- * @return the color channel as a reference to an Image object */ inline Image &channel (int num) { return *m_images[num]; } ! #ifndef _WIN32_WCE ! /** Read the image. All steps independent of the file format will be ! * performed, like testing for file readability etc. * @exception invalid_argument * invalid file format * @exception ios_base::failure ! * a read error has occured [not supported by all libraries, so eventually * {\em invalid_argument} instead] */ void read (char const *fname); ! /** Read an image. Reads an image from a file using the specified * file type. Currently PGM, RAW and PFI are supported. * @exception invalid_argument *************** *** 68,78 **** void read (char const *fname, filetype ftype); ! /** Write the image. All steps independent of the file format will be ! * performed, like testing for file writeability etc. * @exception ios_base::failure ! * a read error has occured [not supported by all libraries, so eventually ! * {\em invalid_argument} instead] * @exception invalid_argument ! * the source image has a different number of colors than the target * format allows * @param fname --- 72,82 ---- void read (char const *fname, filetype ftype); ! /** Write the image. All steps independent of the file format will be ! * performed, like testing for file writeability etc. * @exception ios_base::failure ! * a read error has occured [not supported by all libraries, so eventually ! * {\em invalid_argument} instead] * @exception invalid_argument ! * the source image has a different number of colors than the target * format allows * @param fname *************** *** 81,90 **** * beautify images that have not had more analysis than synthesis steps? */ void write (char const *fname, bool beautify = false); ! /** Write an image (abstract). Writes an image to a file using the * specified file type. * @param ftype * the file type * @param fname ! * the file name, if {\em NULL}, then {\em stdout} * @param beautify * beautify images that have not had more analysis than synthesis steps? */ --- 85,94 ---- * beautify images that have not had more analysis than synthesis steps? */ void write (char const *fname, bool beautify = false); ! /** Write an image (abstract). Writes an image to a file using the * specified file type. * @param ftype * the file type * @param fname ! * the file name, if {\em NULL}, then {\em stdout} * @param beautify * beautify images that have not had more analysis than synthesis steps? */ *************** *** 100,116 **** * transform steps. The original data will be overwritten, so this * should only be used on clones or if the image is not going to be ! * transformed afterwise. One region inside the image could be the ! * low-pass subband and should thus be handled separately. If that is * desired, the {\em ysize} and {\em xsize} parameters should be set ! * to nonzero values. * @param ysize * the horizontal size of the region that should be handled separately ! * @param xsize * the vertical size of the region that should be handled separately * @param yoffs * the horizontal offset of the region that should be handled separately ! * @param xoffs * the vertical offset of the region that should be handled separately */ ! virtual void beautify (int yoffs = 0, int xoffs = 0, int ysize = 0, int xsize = 0); --- 104,120 ---- * transform steps. The original data will be overwritten, so this * should only be used on clones or if the image is not going to be ! * transformed afterwise. One region inside the image could be the ! * low-pass subband and should thus be handled separately. If that is * desired, the {\em ysize} and {\em xsize} parameters should be set ! * to nonzero values. * @param ysize * the horizontal size of the region that should be handled separately ! * @param xsize * the vertical size of the region that should be handled separately * @param yoffs * the horizontal offset of the region that should be handled separately ! * @param xoffs * the vertical offset of the region that should be handled separately */ ! virtual void beautify (int yoffs = 0, int xoffs = 0, int ysize = 0, int xsize = 0); *************** *** 118,121 **** --- 122,131 ---- * @return the copy */ ColorImage *clone (void) const; + /** Copy all data from a source image. + * @param img + * the source image + * @exception invalid_argument if the two images' number of color channels + * do not match */ + virtual void copy (ColorImage &img); /** Return the current image quality factor. *************** *** 127,130 **** --- 137,213 ---- inline void quality (int quality) { m_quality = quality; } + /** Returns a subimage. + * @param yoffs + * the row where to start + * @param xoffs + * the col where to start + * @param ysize + * the vertical size + * @param xsize + * the horizontal size + * @return + * the new image */ + ColorImage *crop (int yoffs, int xoffs, int ysize, int xsize) const; + /** Inserts a subimage. + * @param yoffs + * the row where to start + * @param xoffs + * the col where to start + * @param img + * the image to insert + * @exception invalid_argument if the two images' number of color channels + * do not match */ + virtual void paste (int yoffs, int xoffs, ColorImage &img); + /** Shift an Image. + * @param yoffs + * the rows to shift + * @param xoffs + * the cols to shift */ + virtual void shift (int yoffs, int xoffs); + + /** Produce a scaled version of the image which just fits into + * the given dimensions. If the aspect ratio does not fit into + * the new dimensions the remaining areas can be filled with a + * given color or alternatively the resulting image will be smaller + * than the target dimensions keeping its aspect ratio. + * @exception invalid_argument + * the factor is negative or the function argument is invalid + * @param rows the target number of rows + * @param cols the target number of columns + * @param fill if not NULL it must point to an array of as many + * values as color channels, so that each of the image's channels + * has its own fill greyscale value for the remaining space + * (else the a smaller image size will be chosen if the aspect ratio + * does not match) + * @param function interpolation function (0: bilinear interpolation, + * 1: average, 2: nearest neighbour). + * @return a new rescaled image */ + virtual ColorImage *fitInto (int rows, int cols, + int *fill = NULL, int function = 0) const; + + /** Produce a scaled version of the image. The aspect ratio will remain + * the same. + * @exception invalid_argument + * the factor is negative or the function argument is invalid + * @param factor + * the scale factor (>= 0, 1 for no change) + * @param function interpolation function (0: bilinear interpolation, + * 1: average, 2: nearest neighbour). + * @return a new rescaled image */ + virtual ColorImage *scale (double factor, int function = 0) const; + + /** Produce a scaled version of the image. The aspect ratio depends on the + * two scale factors + * @exception invalid_argument + * the factor is negative or the function argument is invalid + * @param yFactor + * the vertical scale factor (>= 0, 1 for no change) + * @param xFactor + * the horizontal scale factor (>= 0, 1 for no change) + * @param function interpolation function (0: bilinear interpolation, + * 1: average, 2: nearest neighbour). + * @return a new rescaled image */ + virtual ColorImage *scale (double yFactor, double xFactor, int function = 0) const; + private: /** The image quality (if stored in lossy format like JPG) */ *************** *** 133,141 **** /** Allocate objects and set standard values. * @param images ! * an array of {\em colors} images to copy the channel data from * @param isReference * if true, only references to the images will be copied, and they will ! * not be deleted at object destruction */ ! void init (Image **images = NULL, bool isReference = false); /** Deletes allocated objects. */ virtual void destroy (void); --- 216,226 ---- /** Allocate objects and set standard values. * @param images ! * an array of {\em colors} images to copy the channel data from * @param isReference * if true, only references to the images will be copied, and they will ! * not be deleted at object destruction ! * @param isMine if true, the ownership of the incoming images will be ! * transferred to this color image */ ! void init (Image **images = NULL, bool isReference = false, bool isMine = false); /** Deletes allocated objects. */ virtual void destroy (void); Index: Image.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage/Image.hh,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Image.hh 19 Jul 2005 08:41:06 -0000 1.15 --- Image.hh 7 Aug 2007 17:01:00 -0000 1.16 *************** *** 19,24 **** #include "WImage/FileName.hh" ! /** ! * @addtogroup WImage * @{ */ --- 19,24 ---- #include "WImage/FileName.hh" ! /** ! * @addtogroup WImage * @{ */ *************** *** 27,35 **** */ /*abstract*/ ! class Image { public: ! /** Constructor. Only sets standard values. */ Image (void); --- 27,35 ---- */ /*abstract*/ ! class Image { public: ! /** Constructor. Only sets standard values. */ Image (void); *************** *** 56,60 **** * @return * the column reference */ ! inline ColumnVector &col (int x = 0) { m_acol->go (x); return *m_acol; } /** Return a row reference. Returns a pseudo-vector that provides * a reference to one row of the image. --- 56,60 ---- * @return * the column reference */ ! inline ColumnVector &col (int x = 0) { m_acol->go (x); return *m_acol; } /** Return a row reference. Returns a pseudo-vector that provides * a reference to one row of the image. *************** *** 63,67 **** * @return * the row reference */ ! inline RowVector &row (int y = 0) { m_arow->go (y); return *m_arow; } /** Return a full reference. Returns a pseudo-vector that provides --- 63,67 ---- * @return * the row reference */ ! inline RowVector &row (int y = 0) { m_arow->go (y); return *m_arow; } /** Return a full reference. Returns a pseudo-vector that provides *************** *** 71,75 **** * @return * the full reference */ ! inline FullVector &full (int xy = 0) { m_afull->go (xy); return *m_afull; } /** Get a value. Returns the value at row {\em y} and col {\em x}. --- 71,75 ---- * @return * the full reference */ ! inline FullVector &full (int xy = 0) { m_afull->go (xy); return *m_afull; } /** Get a value. Returns the value at row {\em y} and col {\em x}. *************** *** 78,82 **** * @param x * the col ! * @return * the value */ virtual coeff at (int y, int x) const = 0; --- 78,82 ---- * @param x * the col ! * @return * the value */ virtual coeff at (int y, int x) const = 0; *************** *** 84,90 **** * @param abs * the position ! * @return * the value */ ! virtual coeff at (int abs) const = 0; /** Set a value. Sets the value at row {\em y} and col {\em x}. * @param y --- 84,90 ---- * @param abs * the position ! * @return * the value */ ! virtual coeff at (int abs) const = 0; /** Set a value. Sets the value at row {\em y} and col {\em x}. * @param y *************** *** 94,100 **** * @param val * the new value ! * @return * the value */ ! virtual void to (int y, int x, coeff val) = 0; /** Set a value. Sets the value at absolute position {\em abs}. * @param abs --- 94,100 ---- * @param val * the new value ! * @return * the value */ ! virtual void to (int y, int x, coeff val) = 0; /** Set a value. Sets the value at absolute position {\em abs}. * @param abs *************** *** 112,116 **** * the absolute offset */ virtual int abs (int y, int x) const = 0; ! /** Rough comparison. See if two images are similar according to a given * {\em epsilon} (important for floating-point comparisons). --- 112,116 ---- * the absolute offset */ virtual int abs (int y, int x) const = 0; ! /** Rough comparison. See if two images are similar according to a given * {\em epsilon} (important for floating-point comparisons). *************** *** 125,129 **** * @param img * The other {\em Image} object ! * @return * if equals: {\em true}, else {\em false} */ virtual bool equals (Image &img) const = 0; --- 125,129 ---- * @param img * The other {\em Image} object ! * @return * if equals: {\em true}, else {\em false} */ virtual bool equals (Image &img) const = 0; *************** *** 138,158 **** * the inner product */ virtual double iproduct (Image &img) const; ! ! /** Normalize coefficients. * @param factor * the normalization factor */ virtual void normalize (coeff factor); ! /** Unnormalize coefficients. * @param factor * the unnormalization factor */ virtual void unnormalize (coeff factor); ! /** Perform a gamma correction. Since this is normally only defined for the * spatial domain (the pixels need to be normalized) the normalization factor * is set to 255 by default, if values are found in the image outside the * specified [0..norm] range, the range will be increased. ! * If the range is increased a new normalization factor is ! * automatically calculated as the difference between the image's maximum * (if more than norm) and minimum (if less than 0) coefficient value. * @param factor --- 138,158 ---- * the inner product */ virtual double iproduct (Image &img) const; ! ! /** Normalize coefficients. * @param factor * the normalization factor */ virtual void normalize (coeff factor); ! /** Unnormalize coefficients. * @param factor * the unnormalization factor */ virtual void unnormalize (coeff factor); ! /** Perform a gamma correction. Since this is normally only defined for the * spatial domain (the pixels need to be normalized) the normalization factor * is set to 255 by default, if values are found in the image outside the * specified [0..norm] range, the range will be increased. ! * If the range is increased a new normalization factor is ! * automatically calculated as the difference between the image's maximum * (if more than norm) and minimum (if less than 0) coefficient value. * @param factor *************** *** 160,220 **** * @param ysize * the horizontal size of the region to process ! * @param xsize * the vertical size of the region to process * @param yoffs * the horizontal offset of the region to process ! * @param xoffs ! * the vertical offset of the region to process * @param norm * the normalization factor ( default = 255 )*/ virtual void gammaCorrection (double factor, int yoffs = 0, int xoffs = 0, ! int ysize = -1, int xsize = -1, int norm = 255); ! /** Does a automatic gamma correction. This function breaks the image up into ! * smaller matrices and then calculates their averages. The highest and ! * lowest average is then used to calculate a gamma value which is used * to a parameter in a call to gammaCorrection(). ! * @note ! * If the image can not be split into the required sub-areas without a * remainder the nearest solution (down) is used. ! * @param rows * Split image horizontly into subsections ! * @param columns * Split image vertically into subsections ! * @param yoffs * Vertical offset ! * @param xoffs * Horizontal offset ! * @param ysize * Vertical size ! * @param xsize * Horizontal size * @param norm * the normalization factor ( default = 255 ) ! * @return * the gamma value - (use it to undo operation if needed) */ ! double gammaCorrectionAuto (int rows, int columns, int yoffs = 0, int xoffs = 0, int ysize = -1,int xsize = -1, int norm = 255); ! /** Perform a histogram equalisation. * The operation performs a floating-point to int quantisation and uses * a given color range if 0..255 is not desired. Explicit values for the ! * color range can be necessary e.g. for Wavelet-decomposed images; for ! * example for Haar LL Level 1 a good choice would be 0..1023 and -512..511 * for Haar non LL Level 1. ! * Code provided by Johan Ehlers. ! * @warning ! * Use unnormalised coefficients else the operation has un-determinable * results. * @param ysize * the horizontal size of the region to process ! * @param xsize * the vertical size of the region to process * @param yoffs * the horizontal offset of the region to process ! * @param xoffs ! * the vertical offset of the region to process * @param startH * the start value for range of histogram default = 0 --- 160,220 ---- * @param ysize * the horizontal size of the region to process ! * @param xsize * the vertical size of the region to process * @param yoffs * the horizontal offset of the region to process ! * @param xoffs ! * the vertical offset of the region to process * @param norm * the normalization factor ( default = 255 )*/ virtual void gammaCorrection (double factor, int yoffs = 0, int xoffs = 0, ! int ysize = -1, int xsize = -1, int norm = 255); ! /** Does a automatic gamma correction. This function breaks the image up into ! * smaller matrices and then calculates their averages. The highest and ! * lowest average is then used to calculate a gamma value which is used * to a parameter in a call to gammaCorrection(). ! * @note ! * If the image can not be split into the required sub-areas without a * remainder the nearest solution (down) is used. ! * @param rows * Split image horizontly into subsections ! * @param columns * Split image vertically into subsections ! * @param yoffs * Vertical offset ! * @param xoffs * Horizontal offset ! * @param ysize * Vertical size ! * @param xsize * Horizontal size * @param norm * the normalization factor ( default = 255 ) ! * @return * the gamma value - (use it to undo operation if needed) */ ! double gammaCorrectionAuto (int rows, int columns, int yoffs = 0, int xoffs = 0, int ysize = -1,int xsize = -1, int norm = 255); ! /** Perform a histogram equalisation. * The operation performs a floating-point to int quantisation and uses * a given color range if 0..255 is not desired. Explicit values for the ! * color range can be necessary e.g. for Wavelet-decomposed images; for ! * example for Haar LL Level 1 a good choice would be 0..1023 and -512..511 * for Haar non LL Level 1. ! * Code provided by Johan Ehlers. ! * @warning ! * Use unnormalised coefficients else the operation has un-determinable * results. * @param ysize * the horizontal size of the region to process ! * @param xsize * the vertical size of the region to process * @param yoffs * the horizontal offset of the region to process ! * @param xoffs ! * the vertical offset of the region to process * @param startH * the start value for range of histogram default = 0 *************** *** 224,249 **** int ysize = -1, int xsize = -1, int startH = 0, int endH = 255); ! /** Do an intelligent kind of beautification considering previous * transform steps. The original data will be overwritten, so this * should only be used on clones or if the image is not going to be ! * transformed afterwise. One region inside the image could be the ! * low-pass subband and should thus be handled separately. If that is * desired, the {\em ysize} and {\em xsize} parameters should be set ! * to nonzero values. * @param yoffs * the horizontal offset of the region that should be handled separately ! * @param xoffs ! * the vertical offset of the region that should be handled separately * @param ysize * the horizontal size of the region that should be handled separately ! * @param xsize * the vertical size of the region that should be handled separately */ ! virtual void beautify (int yoffs = 0, int xoffs = 0, int ysize = 0, int xsize = 0); ! ! /** Do a dumb kind of beautification by just truncating values to * their possible maxima depending on the image format or whatever. ! * The original data will be overwritten, so this should only be * used on clones or if the original data is not needed anymore. * @param min --- 224,249 ---- int ysize = -1, int xsize = -1, int startH = 0, int endH = 255); ! /** Do an intelligent kind of beautification considering previous * transform steps. The original data will be overwritten, so this * should only be used on clones or if the image is not going to be ! * transformed afterwise. One region inside the image could be the ! * low-pass subband and should thus be handled separately. If that is * desired, the {\em ysize} and {\em xsize} parameters should be set ! * to nonzero values. * @param yoffs * the horizontal offset of the region that should be handled separately ! * @param xoffs ! * the vertical offset of the region that should be handled separately * @param ysize * the horizontal size of the region that should be handled separately ! * @param xsize * the vertical size of the region that should be handled separately */ ! virtual void beautify (int yoffs = 0, int xoffs = 0, int ysize = 0, int xsize = 0); ! ! /** Do a dumb kind of beautification by just truncating values to * their possible maxima depending on the image format or whatever. ! * The original data will be overwritten, so this should only be * used on clones or if the original data is not needed anymore. * @param min *************** *** 256,266 **** * them to integer numbers. */ virtual void pixelize (void); ! /** Adjust the coefficients to make them pixelizable. */ void valadjust (void); #ifndef _WIN32_WCE ! /** Read an image (abstract). Reads an image from a file guessing the ! * file type from the file name's extension. * @param fname * the file name, if {\em NULL}, then {\em stdin} --- 256,266 ---- * them to integer numbers. */ virtual void pixelize (void); ! /** Adjust the coefficients to make them pixelizable. */ void valadjust (void); #ifndef _WIN32_WCE ! /** Read an image (abstract). Reads an image from a file guessing the ! * file type from the file name's extension. * @param fname * the file name, if {\em NULL}, then {\em stdin} *************** *** 280,302 **** * @param rawx * the number of cols (only needed for RAW format) */ ! virtual void read (char const *fname, filetype ftype, int rawy = 0, int rawx = 0) = 0; ! /** Write an image (abstract). Writes an image to a file guessing the * file type from the file name's extension. * @param fname ! * the file name, if {\em NULL}, then {\em stdout} * @param beautify * beautify images that have not had more analysis than synthesis steps? */ virtual void write (char const *fname, bool beautify = false) = 0; ! /** Write an image (abstract). Writes an image to a file using the * specified file type. * @param ftype * the file type * @param fname ! * the file name, if {\em NULL}, then {\em stdout} * @param beautify * beautify images that have not had more analysis than synthesis steps? */ ! virtual void write (char const *fname, filetype ftype, bool beautify = false) = 0; #endif --- 280,302 ---- * @param rawx * the number of cols (only needed for RAW format) */ ! virtual void read (char const *fname, filetype ftype, int rawy = 0, int rawx = 0) = 0; ! /** Write an image (abstract). Writes an image to a file guessing the * file type from the file name's extension. * @param fname ! * the file name, if {\em NULL}, then {\em stdout} * @param beautify * beautify images that have not had more analysis than synthesis steps? */ virtual void write (char const *fname, bool beautify = false) = 0; ! /** Write an image (abstract). Writes an image to a file using the * specified file type. * @param ftype * the file type * @param fname ! * the file name, if {\em NULL}, then {\em stdout} * @param beautify * beautify images that have not had more analysis than synthesis steps? */ ! virtual void write (char const *fname, filetype ftype, bool beautify = false) = 0; #endif *************** *** 327,331 **** virtual pixel * exportPixels (void) const; ! /** Produce a copy (abstract). Every dynamically object will be cloned * rather than passing on the reference. * @return --- 327,331 ---- virtual pixel * exportPixels (void) const; ! /** Produce a copy (abstract). Every dynamically object will be cloned * rather than passing on the reference. * @return *************** *** 337,344 **** virtual void copy (Image &img); ! /** Returns a subimage. * @param yoffs * the row where to start ! * @param xoffs * the col where to start * @param ysize --- 337,344 ---- virtual void copy (Image &img); ! /** Returns a subimage. * @param yoffs * the row where to start ! * @param xoffs * the col where to start * @param ysize *************** *** 349,364 **** * the new image */ Image *crop (int yoffs, int xoffs, int ysize, int xsize) const; ! /** Inserts a subimage. * @param yoffs * the row where to start ! * @param xoffs * the col where to start * @param img * the image to insert */ virtual void paste (int yoffs, int xoffs, Image &img); ! /** Shift an Image. * @param yoffs * the rows to shift ! * @param xoffs * the cols to shift */ virtual void shift (int yoffs, int xoffs); --- 349,364 ---- * the new image */ Image *crop (int yoffs, int xoffs, int ysize, int xsize) const; ! /** Inserts a subimage. * @param yoffs * the row where to start ! * @param xoffs * the col where to start * @param img * the image to insert */ virtual void paste (int yoffs, int xoffs, Image &img); ! /** Shift an Image. * @param yoffs * the rows to shift ! * @param xoffs * the cols to shift */ virtual void shift (int yoffs, int xoffs); *************** *** 380,385 **** * the number of steps */ void synsteps (int steps) { m_ssteps = steps; } ! ! /** Returns the maximum value in a region. Signs will be considered. * @param fromY the first point's row * @param fromX the first point's col --- 380,385 ---- * the number of steps */ void synsteps (int steps) { m_ssteps = steps; } ! ! /** Returns the maximum value in a region. Signs will be considered. * @param fromY the first point's row * @param fromX the first point's col *************** *** 390,394 **** virtual coeff smax (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1) const = 0; ! /** Returns the maximum value in a region. Signs will be considered. * @param fromY the first point's row * @param fromX the first point's col --- 390,394 ---- virtual coeff smax (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1) const = 0; ! /** Returns the maximum value in a region. Signs will be considered. * @param fromY the first point's row * @param fromX the first point's col *************** *** 425,429 **** * @param toX the second point's col (-1 if right image border) * @return the average color */ ! virtual coeff saverage (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1) const = 0; --- 425,429 ---- * @param toX the second point's col (-1 if right image border) * @return the average color */ ! virtual coeff saverage (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1) const = 0; *************** *** 436,440 **** * @param toX the second point's col (-1 if right image border) * @return the average color */ ! virtual coeff aaverage (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1) const = 0; --- 436,440 ---- * @param toX the second point's col (-1 if right image border) * @return the average color */ ! virtual coeff aaverage (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1) const = 0; *************** *** 449,458 **** * @param toX the second point's col (-1 if right image border) * @return the square variance */ ! virtual coeff sqvariance (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1) const; /** Return the variance for a rectangular region inside the image * drawn from one point within and the second point just outside the ! * region. Use this method if you want statistics on a region in the * image. For other cases you may want to use ImageInformation::variance(). * @param fromY the first point's row --- 449,458 ---- * @param toX the second point's col (-1 if right image border) * @return the square variance */ ! virtual coeff sqvariance (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1) const; /** Return the variance for a rectangular region inside the image * drawn from one point within and the second point just outside the ! * region. Use this method if you want statistics on a region in the * image. For other cases you may want to use ImageInformation::variance(). * @param fromY the first point's row *************** *** 462,470 **** * @param abs true if signs are discarded * @return the square variance */ ! virtual coeff variance (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1, bool abs = false) const; ! /** Returns the standard deviation for a rectangular region inside the ! * image drawn from one point within and the second point just outside * the region. Signs will be considered. Use this method if you want * statistics on a region in the image. For other cases you may want --- 462,470 ---- * @param abs true if signs are discarded * @return the square variance */ ! virtual coeff variance (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1, bool abs = false) const; ! /** Returns the standard deviation for a rectangular region inside the ! * image drawn from one point within and the second point just outside * the region. Signs will be considered. Use this method if you want * statistics on a region in the image. For other cases you may want *************** *** 476,484 **** * @param abs true if signs are discarded * @return the standard deviation. */ ! virtual coeff sdeviation (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1, bool abs = false) const; /** Resize the image's x/y dimensions. The old values will remain ! * as far as they fit in the new dimensions. The new dimensions must * all be greater than zero. * @exception invalid_argument --- 476,484 ---- * @param abs true if signs are discarded * @return the standard deviation. */ ! virtual coeff sdeviation (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1, bool abs = false) const; /** Resize the image's x/y dimensions. The old values will remain ! * as far as they fit in the new dimensions. The new dimensions must * all be greater than zero. * @exception invalid_argument *************** *** 490,498 **** virtual void resize (int rows, int cols) = 0; ! /** Produce a scaled version of the image. The aspect ratio will remain * the same. * @exception invalid_argument * the factor is negative or the function argument is invalid ! * @param factor * the scale factor (>= 0, 1 for no change) * @param function interpolation function (0: bilinear interpolation, --- 490,516 ---- virtual void resize (int rows, int cols) = 0; ! /** Produce a scaled version of the image which just fits into ! * the given dimensions. If the aspect ratio does not fit into ! * the new dimensions the remaining areas can be filled with a ! * given color or alternatively the resulting image will be smaller ! * than the target dimensions keeping its aspect ratio. ! * @exception invalid_argument ! * the factor is negative or the function argument is invalid ! * @param rows the target number of rows ! * @param cols the target number of columns ! * @param fill if not less than zero use this to fill remaining space ! * (else the a smaller image size will be chosen if the aspect ratio ! * does not match) ! * @param function interpolation function (0: bilinear interpolation, ! * 1: average, 2: nearest neighbour). ! * @return a new rescaled image */ ! virtual Image *fitInto (int rows, int cols, ! int fill = -1, int function = 0) const; ! ! /** Produce a scaled version of the image. The aspect ratio will remain * the same. * @exception invalid_argument * the factor is negative or the function argument is invalid ! * @param factor * the scale factor (>= 0, 1 for no change) * @param function interpolation function (0: bilinear interpolation, *************** *** 500,511 **** * @return a new rescaled image */ virtual Image *scale (double factor, int function = 0) const; ! /** Produce a scaled version of the image. The aspect ratio depends on the * two scale factors * @exception invalid_argument * the factor is negative or the function argument is invalid ! * @param yFactor * the vertical scale factor (>= 0, 1 for no change) ! * @param xFactor * the horizontal scale factor (>= 0, 1 for no change) * @param function interpolation function (0: bilinear interpolation, --- 518,529 ---- * @return a new rescaled image */ virtual Image *scale (double factor, int function = 0) const; ! /** Produce a scaled version of the image. The aspect ratio depends on the * two scale factors * @exception invalid_argument * the factor is negative or the function argument is invalid ! * @param yFactor * the vertical scale factor (>= 0, 1 for no change) ! * @param xFactor * the horizontal scale factor (>= 0, 1 for no change) * @param function interpolation function (0: bilinear interpolation, *************** *** 513,517 **** * @return a new rescaled image */ virtual Image *scale (double yFactor, double xFactor, int function = 0) const; ! #ifdef USE_DEPRECATED_API /** Rough comparison. See if two images are similar according to a given --- 531,535 ---- * @return a new rescaled image */ virtual Image *scale (double yFactor, double xFactor, int function = 0) const; ! #ifdef USE_DEPRECATED_API /** Rough comparison. See if two images are similar according to a given *************** *** 523,532 **** * @return * if both are identical: {\em true}, else {\em false} */ ! inline bool epsilons (Image *img, coeff epsilon) const { return this->epsilons (*img, epsilon); } /** Compares two images. Return {\em true} if both are equal. * @param img * The other {\em Image} object ! * @return * if equals: {\em true}, else {\em false} */ inline bool equals (Image *img) const { return this->equals (*img); } --- 541,550 ---- * @return * if both are identical: {\em true}, else {\em false} */ ! inline bool epsilons (Image *img, coeff epsilon) const { return this->epsilons (*img, epsilon); } /** Compares two images. Return {\em true} if both are equal. * @param img * The other {\em Image} object ! * @return * if equals: {\em true}, else {\em false} */ inline bool equals (Image *img) const { return this->equals (*img); } *************** *** 558,570 **** * the other image */ void dimcheck (const Image &img) const; ! /** Abstract factory method to get a new instance of a given size * filled with zeroes. * @param rows * the number of rows * @param cols ! * the number of cols * @return the new image */ virtual Image *mkImage (int rows = 0, int cols = 0) const = 0; ! }; /* class Image */ --- 576,588 ---- * the other image */ void dimcheck (const Image &img) const; ! /** Abstract factory method to get a new instance of a given size * filled with zeroes. * @param rows * the number of rows * @param cols ! * the number of cols * @return the new image */ virtual Image *mkImage (int rows = 0, int cols = 0) const = 0; ! }; /* class Image */ Index: ColorBuffer.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage/ColorBuffer.hh,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ColorBuffer.hh 12 Jul 2005 14:52:18 -0000 1.6 --- ColorBuffer.hh 7 Aug 2007 17:01:00 -0000 1.7 *************** *** 12,17 **** #include "WImage/Image.hh" ! /** ! * @addtogroup WImage * @{ */ --- 12,17 ---- #include "WImage/Image.hh" ! /** ! * @addtogroup WImage * @{ */ *************** *** 19,33 **** * An abstract wrapper for color images and videos. */ ! class ! ColorBuffer { public: /** Constructor. Creates objects and sets actual start values. * @param colors ! * the number of colors, and therefore the array's length ! * @param cmodel * the color model */ ColorBuffer (int colors = 3, clrmodel cmodel = cm_rgb); ! /** Destructor. Frees allocated objects. */ virtual ~ColorBuffer (void); --- 19,33 ---- * An abstract wrapper for color images and videos. */ ! class ! ColorBuffer { public: /** Constructor. Creates objects and sets actual start values. * @param colors ! * the number of colors, and therefore the array's length ! * @param cmodel * the color model */ ColorBuffer (int colors = 3, clrmodel cmodel = cm_rgb); ! /** Destructor. Frees allocated objects. */ virtual ~ColorBuffer (void); *************** *** 53,58 **** * the new colormodel ({\em cm_rgb} or {\em cm_yuv}) */ virtual void colormodel (clrmodel model); ! ! /** Returns the maximum value. Signs will be considered. * @exception invalid_argument * empty image --- 53,58 ---- * the new colormodel ({\em cm_rgb} or {\em cm_yuv}) */ virtual void colormodel (clrmodel model); ! ! /** Returns the maximum value. Signs will be considered. * @exception invalid_argument * empty image *************** *** 60,64 **** * the maximum */ virtual coeff smax (void) const; ! /** Returns the maximum value. Signs will be considered. * @exception invalid_argument * empty image --- 60,64 ---- * the maximum */ virtual coeff smax (void) const; ! /** Returns the maximum value. Signs will be considered. * @exception invalid_argument * empty image *************** *** 73,81 **** virtual int fileSize (char const *fname) const; #endif ! /** Compares two images. Return {\em true} if both are equal. * @param buf * The other {\em ColorBuffer} object ! * @return * if equals: {\em true}, else {\em false} */ virtual bool equals (ColorBuffer &buf) const; --- 73,81 ---- virtual int fileSize (char const *fname) const; #endif ! /** Compares two images. Return {\em true} if both are equal. * @param buf * The other {\em ColorBuffer} object ! * @return * if equals: {\em true}, else {\em false} */ virtual bool equals (ColorBuffer &buf) const; *************** *** 90,96 **** virtual bool epsilons (ColorBuffer &buf, coeff epsilon) const; ! /** Do a dumb kind of beautification by just truncating values to * their possible maxima depending on the image format or whatever. ! * The original data will be overwritten, so this should only be * used on clones or if the original data is not needed anymore. * @param min --- 90,96 ---- virtual bool epsilons (ColorBuffer &buf, coeff epsilon) const; ! /** Do a dumb kind of beautification by just truncating values to * their possible maxima depending on the image format or whatever. ! * The original data will be overwritten, so this should only be * used on clones or if the original data is not needed anymore. * @param min *************** *** 99,119 **** * the maximum allowed value */ virtual void truncate (coeff min = 0, coeff max = 255); ! /** Do an intelligent kind of beautification considering previous * transform steps. The original data will be overwritten, so this * should only be used on clones or if the image is not going to be ! * transformed afterwise. One region inside the image could be the ! * low-pass subband and should thus be handled separately. If that is * desired, the {\em ysize} and {\em xsize} parameters should be set ! * to nonzero values. * @param ysize * the horizontal size of the region that should be handled separately ! * @param xsize * the vertical size of the region that should be handled separately * @param yoffs * the horizontal offset of the region that should be handled separately ! * @param xoffs * the vertical offset of the region that should be handled separately */ ! virtual void beautify (int yoffs = 0, int xoffs = 0, int ysize = 0, int xsize = 0) = 0; --- 99,119 ---- * the maximum allowed value */ virtual void truncate (coeff min = 0, coeff max = 255); ! /** Do an intelligent kind of beautification considering previous * transform steps. The original data will be overwritten, so this * should only be used on clones or if the image is not going to be ! * transformed afterwise. One region inside the image could be the ! * low-pass subband and should thus be handled separately. If that is * desired, the {\em ysize} and {\em xsize} parameters should be set ! * to nonzero values. * @param ysize * the horizontal size of the region that should be handled separately ! * @param xsize * the vertical size of the region that should be handled separately * @param yoffs * the horizontal offset of the region that should be handled separately ! * @param xoffs * the vertical offset of the region that should be handled separately */ ! virtual void beautify (int yoffs = 0, int xoffs = 0, int ysize = 0, int xsize = 0) = 0; *************** *** 126,135 **** * @param toX the second point's col (-1 if right image border) * @return the average color */ ! virtual coeff averageColor (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1); /** Export the image for other applications. This only works if the image * has three channels! ! * @exception invalid_argument if the current colormodel or the one * passed as parameter is unsupported. * @param cmodel the color model in which the image is exported. Currently --- 126,135 ---- * @param toX the second point's col (-1 if right image border) * @return the average color */ ! virtual coeff averageColor (int fromY = 0, int fromX = 0, int toY = -1, int toX = -1); /** Export the image for other applications. This only works if the image * has three channels! ! * @exception invalid_argument if the current colormodel or the one * passed as parameter is unsupported. * @param cmodel the color model in which the image is exported. Currently *************** *** 169,173 **** /** Allocate objects and set standard values. * @param colors ! * the number of colors * @param cmodel * the initial color model */ --- 169,173 ---- /** Allocate objects and set standard values. * @param colors ! * the number of colors * @param cmodel * the initial color model */ Index: ReferenceVector.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage/ReferenceVector.hh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReferenceVector.hh 12 Jul 2005 14:52:19 -0000 1.3 --- ReferenceVector.hh 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 12,31 **** #include "WImage/miscdefs.h" ! /** ! * @addtogroup WImage * @{ */ ! /** * Pseudo-vector (abstract). Provide a two-dimensional array's * rows and columns as vectors with array addressing. */ /*abstract*/ ! class ReferenceVector { public: ! /** Constructor. Simple initialization. */ ! ReferenceVector (void) { m_vroot = 0; } --- 12,31 ---- #include "WImage/miscdefs.h" ! /** ! * @addtogroup WImage * @{ */ ! /** * Pseudo-vector (abstract). Provide a two-dimensional array's * rows and columns as vectors with array addressing. */ /*abstract*/ ! class ReferenceVector { public: ! /** Constructor. Simple initialization. */ ! ReferenceVector (void) { m_vroot = 0; } *************** *** 42,47 **** * the array has been resized. */ virtual void update (void) = 0; ! ! /** Set new root. Depending of what concrete instance is the current * row or col will be set. * @exception invalid_argument --- 42,47 ---- * the array has been resized. */ virtual void update (void) = 0; ! ! /** Set new root. Depending of what concrete instance is the current * row or col will be set. * @exception invalid_argument *************** *** 51,55 **** virtual void go (int root) = 0; ! /** Return a value (abstract). The value is taken from the vector's * position {\em pos}. * @param pos --- 51,55 ---- virtual void go (int root) = 0; ! /** Return a value (abstract). The value is taken from the vector's * position {\em pos}. * @param pos *************** *** 59,63 **** virtual coeff at (int pos) = 0; ! /** Assign a value (abstract). A new value {\em val} is assigned to * the vector's position {\em pos}. * @param pos --- 59,63 ---- virtual coeff at (int pos) = 0; ! /** Assign a value (abstract). A new value {\em val} is assigned to * the vector's position {\em pos}. * @param pos *************** *** 68,72 **** /** Return the vector's size (abstract). Depending on the concrete * instance we will get the associated array's number of rows or cols. ! * @return * the vector's size */ virtual int size (void) = 0; --- 68,72 ---- /** Return the vector's... [truncated message content] |