wavelet-commit Mailing List for Wavelet (Page 3)
Status: Beta
Brought to you by:
herbert
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(16) |
Aug
(16) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(5) |
Jun
|
Jul
|
Aug
(17) |
Sep
(3) |
Oct
|
Nov
|
Dec
(1) |
2008 |
Jan
|
Feb
|
Mar
|
Apr
(10) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
(2) |
Mar
|
Apr
(12) |
May
(6) |
Jun
(3) |
Jul
(1) |
Aug
|
Sep
(3) |
Oct
(5) |
Nov
|
Dec
|
2010 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(6) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
From: Herbert M. D. <he...@us...> - 2008-04-17 07:27:42
|
Update of /cvsroot/wavelet/Wavelet/debian In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13454/debian Modified Files: changelog Log Message: Optional support for using ImageMagick's Magick++ classes for reading and writing images, also some minor additions. Index: changelog =================================================================== RCS file: /cvsroot/wavelet/Wavelet/debian/changelog,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** changelog 15 Aug 2005 16:33:47 -0000 1.21 --- changelog 17 Apr 2008 07:27:35 -0000 1.22 *************** *** 1,2 **** --- 1,12 ---- + libwavelet (1.2) unstable; urgency=low + + * Various bugfixes, added ImageResizer tool class which allows + smart cropping of color images (not very sophisticated yet). + * Optional support for using ImageMagick's Magick++ classes for + reading and writing images + * Code is available in the CVS only + + -- Martin Dietze <he...@sp...> Wed, 16 Apr 2008 17:03:02 +0100 + libwavelet (1.1) unstable; urgency=high |
From: Herbert M. D. <he...@us...> - 2008-04-17 07:27:42
|
Update of /cvsroot/wavelet/Wavelet/WTools In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13454/WTools Modified Files: ImageInformation.hh Log Message: Optional support for using ImageMagick's Magick++ classes for reading and writing images, also some minor additions. Index: ImageInformation.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WTools/ImageInformation.hh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ImageInformation.hh 12 Jul 2005 14:52:19 -0000 1.4 --- ImageInformation.hh 17 Apr 2008 07:27:35 -0000 1.5 *************** *** 13,22 **** #include "WImage/Image.hh" ! /** ! * @addtogroup WTools * @{ */ /** A comparison function type for coefficients. Different criterions * (e.g. value or index) can be used. */ ! typedef bool (*cipredicate) (const CoeffInformation *c1, const CoeffInformation *c2); --- 13,22 ---- #include "WImage/Image.hh" ! /** ! * @addtogroup WTools * @{ */ /** A comparison function type for coefficients. Different criterions * (e.g. value or index) can be used. */ ! typedef bool (*cipredicate) (const CoeffInformation *c1, const CoeffInformation *c2); *************** *** 33,41 **** * methods for sorting, shuffleing etc. are used for watermark. */ ! class ImageInformation { public: ! /** Constructor. Initializes a number of empty components. * @param size the number of components */ ImageInformation (int size = 0); --- 33,41 ---- * methods for sorting, shuffleing etc. are used for watermark. */ ! class ImageInformation { public: ! /** Constructor. Initializes a number of empty components. * @param size the number of components */ ImageInformation (int size = 0); *************** *** 50,63 **** * the number of stored coeffs */ inline int size (void) const { return m_size; } ! /** Get the first n coeffs. * @param n * the number of coeffs ! * @return * a new info object containing the coeffs */ ImageInformation *head (int n); ! /** Get the last n coeffs. * @param n * the number of coeffs ! * @return * a new info object containing the coeffs */ ImageInformation *tail (int n); --- 50,63 ---- * the number of stored coeffs */ inline int size (void) const { return m_size; } ! /** Get the first n coeffs. * @param n * the number of coeffs ! * @return * a new info object containing the coeffs */ ImageInformation *head (int n); ! /** Get the last n coeffs. * @param n * the number of coeffs ! * @return * a new info object containing the coeffs */ ImageInformation *tail (int n); *************** *** 65,69 **** * @param ii * the other ImageInformation object. ! * @return * a new info object containing the coeffs */ ImageInformation *append (ImageInformation &ii); --- 65,69 ---- * @param ii * the other ImageInformation object. ! * @return * a new info object containing the coeffs */ ImageInformation *append (ImageInformation &ii); *************** *** 71,76 **** * @return * a new info object containing a copy of this */ ! inline ImageInformation *clone (void) { ! return head (m_size); //ImageInformation *ret = new ImageInformation (0); //ret->m_coeffs = new CoeffInformation [m_size]; --- 71,76 ---- * @return * a new info object containing a copy of this */ ! inline ImageInformation *clone (void) { ! return head (m_size); //ImageInformation *ret = new ImageInformation (0); //ret->m_coeffs = new CoeffInformation [m_size]; *************** *** 84,93 **** /** Shrink (discard some of the coeffs). * @param newsize ! * the new number of coeffs, if greater than the actual size, the * operation has no effect * @param leavehead * if {\em true} discard from behind, else discard from the top */ void shrink (int newsize, bool leavehead = true); ! /** Equality test. * @param ii * other info object --- 84,93 ---- /** Shrink (discard some of the coeffs). * @param newsize ! * the new number of coeffs, if greater than the actual size, the * operation has no effect * @param leavehead * if {\em true} discard from behind, else discard from the top */ void shrink (int newsize, bool leavehead = true); ! /** Equality test. * @param ii * other info object *************** *** 99,111 **** * @param pos * the info's position in this object (array index) ! * @return * a reference to the coeff info node */ inline CoeffInformation &at (int pos) { return m_coeffs[pos]; } /** Set a position from a CoeffInformation object. ! * @param c * the CoeffInformation object * @param pos * the info's position in this object (array index) */ inline void to (CoeffInformation &c, int pos) { m_coeffs[pos] = c; } /** Resize the object preserving as many old values as possible. * @param size the new size */ --- 99,117 ---- * @param pos * the info's position in this object (array index) ! * @return * a reference to the coeff info node */ inline CoeffInformation &at (int pos) { return m_coeffs[pos]; } /** Set a position from a CoeffInformation object. ! * @param c * the CoeffInformation object * @param pos * the info's position in this object (array index) */ inline void to (CoeffInformation &c, int pos) { m_coeffs[pos] = c; } + /** Set a position from a CoeffInformation object. + * @param c + * the CoeffInformation object + * @param pos + * the info's position in this object (array index) */ + inline void to (const CoeffInformation &c, int pos) { m_coeffs[pos] = c; } /** Resize the object preserving as many old values as possible. * @param size the new size */ *************** *** 118,122 **** void swap (int pos1, int pos2); ! /** Sort the coeffs according to their values. * @param isless * the comparison function to use. */ --- 124,128 ---- void swap (int pos1, int pos2); ! /** Sort the coeffs according to their values. * @param isless * the comparison function to use. */ *************** *** 128,131 **** --- 134,141 ---- /** Sort the coeffs according to their absolute positions in the image. */ void psort (void); + /** Sort the coeffs according to their rows/cols positions in the image. */ + void yxsort (void); + /** Sort the coeffs according to their cols/rows positions in the image. */ + void xysort (void); /** Sort the coeffs according to their IDs. */ void isort (void); *************** *** 157,166 **** * @return true if the position was found */ inline bool isIn (int y, int x) const { return locate (y, x) >= 0; } ! /** Returns true a position's index if it is is in this * ImageInformation object. * @param abs the absolute position in the image * @return the index if found, else -1 */ ! int locate (int abs) const; ! /** Returns true a position's index if it is is in this * ImageInformation object. * @param y the row in the image --- 167,176 ---- * @return true if the position was found */ inline bool isIn (int y, int x) const { return locate (y, x) >= 0; } ! /** Returns true a position's index if it is is in this * ImageInformation object. * @param abs the absolute position in the image * @return the index if found, else -1 */ ! int locate (int abs) const; ! /** Returns true a position's index if it is is in this * ImageInformation object. * @param y the row in the image *************** *** 184,201 **** * the minimum value */ coeff smin (void); ! #ifndef _WIN32_WCE ! /** Write the contents to stdout or a file. * @exception ios_base::failure if the file could not be opened for writing. ! * @param delim what to print between two entries * @param file the name of the file (empty string for stdout) */ void dump (const char *delim = " ", const char *file = "") const; #endif ! /** Return the average absolute greyscale value. * @return the average absolute greyscale value */ coeff aaverage (void) const; ! /** Return the average (signed) greyscale value. * @return the average greyscale value */ coeff saverage (void) const; --- 194,211 ---- * the minimum value */ coeff smin (void); ! #ifndef _WIN32_WCE ! /** Write the contents to stdout or a file. * @exception ios_base::failure if the file could not be opened for writing. ! * @param delim what to print between two entries * @param file the name of the file (empty string for stdout) */ void dump (const char *delim = " ", const char *file = "") const; #endif ! /** Return the average absolute greyscale value. * @return the average absolute greyscale value */ coeff aaverage (void) const; ! /** Return the average (signed) greyscale value. * @return the average greyscale value */ coeff saverage (void) const; *************** *** 210,214 **** double variance (bool abs = false) const; ! /** Returns the standard deviation. * @param abs true if signs are discarded. * @return the standard deviation. */ --- 220,224 ---- double variance (bool abs = false) const; ! /** Returns the standard deviation. * @param abs true if signs are discarded. * @return the standard deviation. */ *************** *** 216,220 **** #ifdef USE_DEPRECATED_API ! /** Equality test. * @param ii * other info object --- 226,230 ---- #ifdef USE_DEPRECATED_API ! /** Equality test. * @param ii * other info object *************** *** 229,233 **** /** The number of coeffs. */ int m_size; ! /** Obtain a subset of the coeffs. * @param coeffs * the address of the CoeffInformation array to write to --- 239,243 ---- /** The number of coeffs. */ int m_size; ! /** Obtain a subset of the coeffs. * @param coeffs * the address of the CoeffInformation array to write to *************** *** 238,242 **** * the bottom */ void copyCoeffs (CoeffInformation *coeffs, int size, bool head); ! /** Obtain a new info object containging a subset of the coeffs. * @param size * the number of coeffs to be stored --- 248,252 ---- * the bottom */ void copyCoeffs (CoeffInformation *coeffs, int size, bool head); ! /** Obtain a new info object containging a subset of the coeffs. * @param size * the number of coeffs to be stored *************** *** 255,259 **** * the pseudo-random number */ int randint (int from, int to); ! /** Sort the coefficients. A Quicksort algorithm according to * Jon Bentley. * @param from --- 265,269 ---- * the pseudo-random number */ int randint (int from, int to); ! /** Sort the coefficients. A Quicksort algorithm according to * Jon Bentley. * @param from *************** *** 262,269 **** * the end index (included in sort) * @param isless ! * the the comparison function, {\em true} when the left arg is * less than the right one */ void quicksort (int from, int to, cipredicate isless); ! }; /* class ImageInformation */ --- 272,279 ---- * the end index (included in sort) * @param isless ! * the the comparison function, {\em true} when the left arg is * less than the right one */ void quicksort (int from, int to, cipredicate isless); ! }; /* class ImageInformation */ |
From: Herbert M. D. <he...@us...> - 2007-12-03 12:41:00
|
Update of /cvsroot/wavelet/Wavelet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv17313 Modified Files: ChangeLog Log Message: added recent changes to ChangeLog file Index: ChangeLog =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ChangeLog,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ChangeLog 15 Aug 2005 16:33:47 -0000 1.23 --- ChangeLog 3 Dec 2007 12:40:51 -0000 1.24 *************** *** 1,2 **** --- 1,7 ---- + 2007-08-07 Herbert <he...@sp...> + * Various bugfixes, added ImageResizer tool class which allows + smart cropping of color images (not very sophisticated yet). + * Code is available in the CVS only + 2005-08-15 Herbert <he...@sp...> * Fixed a serious memory leak in ColorVideo and a number of minor |
From: Herbert M. D. <he...@us...> - 2007-09-21 08:13:54
|
Update of /cvsroot/wavelet/Wavelet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv25537 Modified Files: ImageResizer.cc Log Message: fixed incorrect filling in ImageResizer Index: ImageResizer.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ImageResizer.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ImageResizer.cc 24 Aug 2007 15:24:28 -0000 1.4 --- ImageResizer.cc 21 Sep 2007 08:13:49 -0000 1.5 *************** *** 193,225 **** if (ysize != tmp->rows () || xsize != tmp->cols ()) { ! ColorImage *result = NEW (ColorImage (ysize, xsize, ! tmp->colors (), tmp->colormodel ())); result->paste (yoffs, xoffs, *tmp); - if (ysize > tmp->rows ()) - { - int fillRows = (result->rows () - tmp->rows () + 1) / 2; - - result->fill (m_fill, - 0, 0, - fillRows, result->cols ()); - - result->fill (m_fill, - tmp->rows () + fillRows, 0, - result->rows (), result->cols ()); - } - else - { - int fillCols = (result->cols () - tmp->cols () + 1) / 2; - - result->fill (m_fill, - 0, 0, - result->rows (), fillCols); - - result->fill (m_fill, - 0, tmp->cols () + fillCols, - result->rows (), result->cols ()); - } DELETE (tmp); return result; --- 193,202 ---- if (ysize != tmp->rows () || xsize != tmp->cols ()) { ! ColorImage *result = ! NEW (ColorImage (ysize, xsize, tmp->colors (), tmp->colormodel ())); + result->fill (m_fill, 0, 0, result->rows (), result->cols ()); result->paste (yoffs, xoffs, *tmp); DELETE (tmp); return result; |
From: Herbert M. D. <he...@us...> - 2007-09-19 09:35:13
|
Update of /cvsroot/wavelet/Wavelet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv28437 Modified Files: AviWriter.cc PgmWriter.cc tools.cc Log Message: Some syntax fixes for g++ 4.2 compatibility Index: AviWriter.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/AviWriter.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AviWriter.cc 7 Aug 2007 17:00:58 -0000 1.8 --- AviWriter.cc 19 Sep 2007 09:35:07 -0000 1.9 *************** *** 52,56 **** int xysize = m_arrays[0]->size (); int frames = m_arrays[0]->frames (); ! AVI_set_video(avi, xsize, ysize, m_frameRate, ""); oneFrame = NEW (pixel [m_channels * xysize]); /* import */ --- 52,56 ---- int xysize = m_arrays[0]->size (); int frames = m_arrays[0]->frames (); ! AVI_set_video(avi, xsize, ysize, m_frameRate, (char*)""); oneFrame = NEW (pixel [m_channels * xysize]); /* import */ Index: PgmWriter.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PgmWriter.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PgmWriter.cc 7 Aug 2007 17:00:58 -0000 1.3 --- PgmWriter.cc 19 Sep 2007 09:35:07 -0000 1.4 *************** *** 20,24 **** { fhandle = stdout; ! writename = "none (stdout)"; } else --- 20,24 ---- { fhandle = stdout; ! writename = (char*)"none (stdout)"; } else Index: tools.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** tools.cc 7 Aug 2007 17:00:59 -0000 1.7 --- tools.cc 19 Sep 2007 09:35:07 -0000 1.8 *************** *** 84,88 **** tools_areaToString (const area a) { ! static char *names[HH + 1] = {"LL", "HL", "LH", "HH"}; return names[a]; } --- 84,88 ---- tools_areaToString (const area a) { ! static const char *names[HH + 1] = {"LL", "HL", "LH", "HH"}; return names[a]; } |
From: Herbert M. D. <he...@us...> - 2007-09-19 09:35:13
|
Update of /cvsroot/wavelet/Wavelet/tools In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv28437/tools Modified Files: pgminmax.cc Log Message: Some syntax fixes for g++ 4.2 compatibility Index: pgminmax.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/pgminmax.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pgminmax.cc 7 Aug 2007 17:01:00 -0000 1.4 --- pgminmax.cc 19 Sep 2007 09:35:08 -0000 1.5 *************** *** 17,21 **** #endif ! static void print_value (char *message, Image *image, CoeffInformation &ci); static int print_stats (char *fname); --- 17,21 ---- #endif ! static void print_value (const char *message, Image *image, CoeffInformation &ci); static int print_stats (char *fname); *************** *** 83,87 **** CoeffInformation max = ii->at (last); ! print_value ("min: ", image, min); for (int i = 1; min.svcmp (ii->at (i)) == 0; i++) --- 83,87 ---- CoeffInformation max = ii->at (last); ! print_value ((char*)"min: ", image, min); for (int i = 1; min.svcmp (ii->at (i)) == 0; i++) *************** *** 105,109 **** static void ! print_value (char *message, Image *image, CoeffInformation &ci) { cout.setf (ios::fixed, ios::floatfield); --- 105,109 ---- static void ! print_value (const char *message, Image *image, CoeffInformation &ci) { cout.setf (ios::fixed, ios::floatfield); |
From: Herbert M. D. <he...@us...> - 2007-08-24 15:24:36
|
Update of /cvsroot/wavelet/Wavelet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10904 Modified Files: ColorImage.cc Image.cc ImageResizer.cc Log Message: New Image::fill() and ColorImage::fill() operations, extensions to the ImageResizer class, the actual resizing after cropping can now be skipped. Index: ColorImage.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ColorImage.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ColorImage.cc 7 Aug 2007 17:00:58 -0000 1.9 --- ColorImage.cc 24 Aug 2007 15:24:27 -0000 1.10 *************** *** 55,58 **** --- 55,68 ---- } + ColorImage::ColorImage (int rows, int cols, int colors, clrmodel cmodel) + : ColorBuffer (colors, cmodel) + { + for (int i = 0; i < m_colors; i++) + { + m_images[i] = NEW (StillImage (rows, cols)); + } + } + + ColorImage::~ColorImage (void) { *************** *** 421,424 **** --- 431,452 ---- } + void + ColorImage::fill (coeff *values, int fromY, int fromX, int toY, int toX) + { + for (int i = 0; i < colors (); i++) + { + m_images[i]->fill (values[i], fromY, fromX, toY, toX); + } + } + + void + ColorImage::fill (int *values, int fromY, int fromX, int toY, int toX) + { + for (int i = 0; i < colors (); i++) + { + m_images[i]->fill (values[i], fromY, fromX, toY, toX); + } + } + ColorImage * ColorImage::fitInto (int rows, int cols, int *fill, int function) const Index: Image.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Image.cc,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Image.cc 15 Aug 2007 13:13:57 -0000 1.26 --- Image.cc 24 Aug 2007 15:24:28 -0000 1.27 *************** *** 133,136 **** --- 133,151 ---- } + void + Image::fill (coeff value, int fromY, int fromX, int toY, int toX) + { + int lower = (toY < 0)? m_ysize: toY; + int right = (toX < 0)? m_xsize: toX; + + for (int y = (fromY < 0? 0: fromY); y < lower && y < m_ysize; y++) + { + for (int x = (fromX < 0? 0: fromX); x < right && x < m_xsize; x++) + { + this->to (y, x, value); + } + } + } + coeff Image::sqvariance (int fromY, int fromX, int toY, int toX) const *************** *** 810,814 **** { image->to (y, x, g_calc[function] (*this, ! y - rowOffset, x - colOffset, theFactor)); } } --- 825,831 ---- { image->to (y, x, g_calc[function] (*this, ! y - rowOffset, ! x - colOffset, ! theFactor)); } } Index: ImageResizer.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ImageResizer.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ImageResizer.cc 10 Aug 2007 18:38:14 -0000 1.3 --- ImageResizer.cc 24 Aug 2007 15:24:28 -0000 1.4 *************** *** 27,36 **** int *fill, coeff threshold, bool optimizeImage, int scalingStrategy) ! : m_image (img), m_maxDetail (NULL), m_filter (flt), ! m_qRows (0), m_qCols (0), m_scalingStrategy (scalingStrategy), m_innerAvgPerSize (0), m_innerSDeviation (0), m_innerRegionSize (0), m_threshold (threshold), m_optimizeImage (optimizeImage), m_optimizationCalculated (false), ! m_cropMaxRows (0), m_cropMaxCols (0), m_rowsMapping (0), m_colsMapping (0) { if (fill == NULL) --- 27,36 ---- int *fill, coeff threshold, bool optimizeImage, int scalingStrategy) ! : m_image (img), m_maxDetail (NULL), m_filter (flt), m_qRows (0), m_qCols (0), m_scalingStrategy (scalingStrategy), m_innerAvgPerSize (0), m_innerSDeviation (0), m_innerRegionSize (0), m_threshold (threshold), m_optimizeImage (optimizeImage), m_optimizationCalculated (false), ! m_cropMaxRows (0), m_cropMaxCols (0), m_rowsMapping (0), m_colsMapping (0), ! m_steps (-1) { if (fill == NULL) *************** *** 65,68 **** --- 65,70 ---- WaveletTransform *transform = NULL; + DELETENOTNULL (m_maxDetail); + /* perform a wavelet transform on all channels and from this calculate the * image containing the max values from all channels' detail areas */ *************** *** 132,138 **** ColorImage* ! ImageResizer::doResizeImage(int rows, int cols, int discardRows, int discardCols) { ! ColorImage *tmp = NULL; if (discardRows > 0 || discardCols > 0) { --- 134,140 ---- ColorImage* ! ImageResizer::getCroppedImage (int discardRows, int discardCols) { ! ColorImage *result = NULL; if (discardRows > 0 || discardCols > 0) { *************** *** 144,153 **** /* TOOD this is far from optimal, but let's just see how it works first */ ! tmp = m_image.crop (fromY, fromX, sizeY, sizeX); } else { ! tmp = m_image.clone (); } if (m_cropWhat == CROP_AUTOMATICALLY) --- 146,235 ---- /* TOOD this is far from optimal, but let's just see how it works first */ ! result = m_image.crop (fromY, fromX, sizeY, sizeX); } else { ! result = m_image.clone (); ! } ! ! return result; ! } ! ! ColorImage* ! ImageResizer::getUnscaledImage (int rows, int cols, int discardRows, int discardCols) ! { ! ColorImage *tmp = getCroppedImage (discardRows, discardCols); ! ! if (m_fill == NULL) ! { ! return tmp; ! } ! ! int yoffs, xoffs, ysize, xsize; ! double oldRatio = (double)tmp->rows () / tmp->cols (); ! double newRatio = (double)rows / cols; ! if (oldRatio < newRatio) ! { ! // need to add rows ! // ysize / tmp->cols () == newRatio ! ysize = (int)(newRatio * tmp->cols () + 0.5); ! yoffs = (ysize - tmp->rows ()) / 2; ! xsize = tmp->cols (); ! xoffs = 0; ! assert (ysize >= tmp->rows ()); ! } ! else ! { ! // need to add cols ! // tmp->rows () / xsize == newRatio ! xsize = (int)(tmp->rows () / newRatio + 0.5); ! xoffs = (xsize - tmp->cols ()) / 2; ! ysize = tmp->rows (); ! yoffs = 0; ! assert (xsize >= tmp->cols ()); ! } ! assert (!(xsize != tmp->cols () && ysize != tmp->rows ())); ! ! if (ysize != tmp->rows () || xsize != tmp->cols ()) ! { ! ColorImage *result = NEW (ColorImage (ysize, xsize, ! tmp->colors (), tmp->colormodel ())); ! ! result->paste (yoffs, xoffs, *tmp); ! ! if (ysize > tmp->rows ()) ! { ! int fillRows = (result->rows () - tmp->rows () + 1) / 2; ! ! result->fill (m_fill, ! 0, 0, ! fillRows, result->cols ()); ! ! result->fill (m_fill, ! tmp->rows () + fillRows, 0, ! result->rows (), result->cols ()); ! } ! else ! { ! int fillCols = (result->cols () - tmp->cols () + 1) / 2; ! ! result->fill (m_fill, ! 0, 0, ! result->rows (), fillCols); ! ! result->fill (m_fill, ! 0, tmp->cols () + fillCols, ! result->rows (), result->cols ()); ! } ! DELETE (tmp); ! return result; } + return tmp; + } + + ColorImage* + ImageResizer::getScaledImage (int rows, int cols, int discardRows, int discardCols) + { + ColorImage *tmp = getCroppedImage (discardRows, discardCols); if (m_cropWhat == CROP_AUTOMATICALLY) *************** *** 349,353 **** ColorImage* ! ImageResizer::resize(int rows, int cols, int steps) { if ((rows <= 0 || cols <= 0) && !(rows == 0 && cols == 0 && m_optimizeImage)) --- 431,435 ---- ColorImage* ! ImageResizer::doResize (int rows, int cols, int steps, bool redimensionOnly) { if ((rows <= 0 || cols <= 0) && !(rows == 0 && cols == 0 && m_optimizeImage)) *************** *** 359,363 **** /* no dimension change necessary? do the job and go away */ ! if (m_cropWhat == CROP_BOTH_OR_NONE && !m_optimizeImage) { return m_image.scale (m_qRows, m_scalingStrategy); --- 441,445 ---- /* no dimension change necessary? do the job and go away */ ! if (m_cropWhat == CROP_BOTH_OR_NONE && !m_optimizeImage && !redimensionOnly) { return m_image.scale (m_qRows, m_scalingStrategy); *************** *** 365,370 **** /* We call genMaxDetail only once to save time */ ! if (m_maxDetail == NULL) { genMaxDetail (steps); } --- 447,453 ---- /* We call genMaxDetail only once to save time */ ! if (m_maxDetail == NULL || steps != m_steps) { + m_steps = steps; genMaxDetail (steps); } *************** *** 414,421 **** } ! ColorImage *ret = doResizeImage (rows, cols, nDiscardRows, nDiscardCols); ! ! return ret; } --- 497,515 ---- } ! return redimensionOnly? ! getUnscaledImage (rows, cols, nDiscardRows, nDiscardCols) : ! getScaledImage (rows, cols, nDiscardRows, nDiscardCols); } + ColorImage* + ImageResizer::resize (int rows, int cols, int steps) + { + return doResize (rows, cols, steps, false); + } + + ColorImage* + ImageResizer::redimension (int rows, int cols, int steps) + { + return doResize (rows, cols, steps, true); + } |
From: Herbert M. D. <he...@us...> - 2007-08-24 15:24:34
|
Update of /cvsroot/wavelet/Wavelet/WTools In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10904/WTools Modified Files: ImageResizer.hh Log Message: New Image::fill() and ColorImage::fill() operations, extensions to the ImageResizer class, the actual resizing after cropping can now be skipped. Index: ImageResizer.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WTools/ImageResizer.hh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ImageResizer.hh 22 Aug 2007 13:34:09 -0000 1.3 --- ImageResizer.hh 24 Aug 2007 15:24:28 -0000 1.4 *************** *** 72,75 **** --- 72,93 ---- /** + * Prepare an image for resizing to x/y dimensions. The result image will be + * cropped to optimally fit in the new dimensions. The maximal percentage + * of cropping as well as the thresholds for guessing insignificant areas + * can be set. This operation skips the actual scaling, so that it can be + * performed by someone else. + * The new dimensions must all be greater than zero. + * @exception invalid_argument + * one or both dimensions are either negative or zero + * @param rows + * the new number of rows + * @param cols + * the new number of cols + * @param steps the number of steps to decompose before checking for features + * @return the new redimensioned image + */ + ColorImage* redimension (int rows, int cols, int steps = 1); + + /** * Return the inner (absolute) average per size (used for quality measurements) * @return the inner average per size *************** *** 195,200 **** /** ! * Create the final result image using the previously calculated number of ! * vectors to discard. * @param rows the number of rows * @param cols the number of cols --- 213,218 ---- /** ! * Create the final unscaled result image using the previously calculated ! * number of vectors to discard. * @param rows the number of rows * @param cols the number of cols *************** *** 207,211 **** * @return the result image */ ! ColorImage* doResizeImage (int rows, int cols, int discardRows, int discardCols); const ColorImage &m_image; --- 225,278 ---- * @return the result image */ ! ColorImage* getUnscaledImage (int rows, int cols, int discardRows, int discardCols); ! ! /** ! * Create the final scaled result image using the previously calculated number ! * of vectors to discard. ! * @param rows the number of rows ! * @param cols the number of cols ! * @param discardRows the number of rows to discard on each side ! * (i.e. we actually discard 2 * discardRows overall); if less than or equal ! * to zero, nothing will be discarded ! * @param discardCols the number of rows to discard on each side ! * (i.e. we actually discard 2 * discardCols overall); if less than or equal ! * to zero, nothing will be discarded ! * @return the result image ! */ ! ColorImage* getScaledImage (int rows, int cols, int discardRows, int discardCols); ! ! /** ! * This operation applies the cropping using the previously calculated numbers ! * of rows or cols which can be safely discarded. ! * @param discardRows the number of rows to discard on each side ! * (i.e. we actually discard 2 * discardRows overall); if less than or equal ! * to zero, nothing will be discarded ! * @param discardCols the number of rows to discard on each side ! * (i.e. we actually discard 2 * discardCols overall); if less than or equal ! * to zero, nothing will be discarded ! * @return the cropped image or a copy of the original if nothing was cropped ! */ ! ColorImage* getCroppedImage (int discardRows, int discardCols); ! ! /** Create a resized image's of x/y dimensions. The result image will be ! * cropped to optimally fit in the new dimensions. The maximal percentage ! * of cropping as well as the thresholds for guessing insignificant areas ! * can be set. If both dimensions are set to 0 and the optimization feature ! * is set, we get an auto-crop (i.e. the size is chosen from the image's ! * contents) ! * The new dimensions must all be greater than zero. ! * @exception invalid_argument ! * one or both dimensions are either negative or zero ! * @param rows ! * the new number of rows ! * @param cols ! * the new number of cols ! * @param steps the number of steps to decompose before checking for features ! * @param redimensionOnly if true, the image will be prepared for scaling, ! * i.e. the dimensions are fixed filling performed etc., so that it can be ! * scaled by some other application later. ! * @return the new resized or prepared image ! */ ! ColorImage* doResize (int rows, int cols, int steps, bool redimensionOnly); const ColorImage &m_image; *************** *** 226,229 **** --- 293,297 ---- double m_rowsMapping; double m_colsMapping; + int m_steps; enum { CROP_COLS, CROP_ROWS, CROP_BOTH_OR_NONE, CROP_AUTOMATICALLY |
From: Herbert M. D. <he...@us...> - 2007-08-24 15:24:33
|
Update of /cvsroot/wavelet/Wavelet/WImage In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv10904/WImage Modified Files: ColorImage.hh Image.hh Log Message: New Image::fill() and ColorImage::fill() operations, extensions to the ImageResizer class, the actual resizing after cropping can now be skipped. Index: Image.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage/Image.hh,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Image.hh 10 Aug 2007 17:55:45 -0000 1.17 --- Image.hh 24 Aug 2007 15:24:28 -0000 1.18 *************** *** 381,384 **** --- 381,394 ---- void synsteps (int steps) { m_ssteps = steps; } + /** Fills an image (or regions of it) with a given value + * @param val the new value for the selected positions + * @param fromY the first point's row + * @param fromX the first point's col + * @param toY the second point's row (-1 if lower image border) + * @param toX the second point's col (-1 if right image border) + */ + void fill (coeff value, int fromY = 0, int fromX = 0, + int toY = -1, int toX = -1); + /** Returns the maximum value in a region. Signs will be considered. * @param fromY the first point's row Index: ColorImage.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage/ColorImage.hh,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ColorImage.hh 7 Aug 2007 17:01:00 -0000 1.6 --- ColorImage.hh 24 Aug 2007 15:24:28 -0000 1.7 *************** *** 42,45 **** --- 42,57 ---- Image **images = NULL, bool isReference = false, bool isMine = false); + /** Constructor. Creates an image of a given size. + * @param rows + * the number of image rows to create + * @param cols + * the number of image cols to create + * @param colors + * the number of colors + * @param cmodel + * the color model + */ + ColorImage (int rows, int cols, int colors = 3, clrmodel cmodel = cm_rgb); + /** Destructor. Frees allocated objects. */ virtual ~ColorImage (void); *************** *** 165,168 **** --- 177,200 ---- * the cols to shift */ virtual void shift (int yoffs, int xoffs); + /** Fills an image (or regions of it) with a given value + * @param values an array of this->colors() entries containing the the new + * values one per channel for the selected positions (coeff values) + * @param fromY the first point's row + * @param fromX the first point's col + * @param toY the second point's row (-1 if lower image border) + * @param toX the second point's col (-1 if right image border) + */ + void fill (coeff *values, int fromY = 0, int fromX = 0, + int toY = -1, int toX = -1); + /** Fills an image (or regions of it) with a given value + * @param values an array of this->colors() entries containing the the new + * values one per channel for the selected positions (int values) + * @param fromY the first point's row + * @param fromX the first point's col + * @param toY the second point's row (-1 if lower image border) + * @param toX the second point's col (-1 if right image border) + */ + void fill (int *values, int fromY = 0, int fromX = 0, + int toY = -1, int toX = -1); /** Produce a scaled version of the image which just fits into |
From: Herbert M. D. <he...@us...> - 2007-08-22 13:34:16
|
Update of /cvsroot/wavelet/Wavelet/WTools In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv32033/WTools Modified Files: ImageResizer.hh Log Message: Added methods for setting and returning the auto-optimization feature state for the ImageResizer class. Index: ImageResizer.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WTools/ImageResizer.hh,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ImageResizer.hh 10 Aug 2007 17:55:45 -0000 1.2 --- ImageResizer.hh 22 Aug 2007 13:34:09 -0000 1.3 *************** *** 75,89 **** * @return the inner average per size */ ! inline double getInnerAvgPerSize (void) { return m_innerAvgPerSize; } /** * Return the inner standard deviation (used for quality measurements) * @return the inner standard deviation */ ! inline double getInnerSDeviation (void) { return m_innerSDeviation; } /** * Return the size of the inner region used for the above calculation * @return the size of the inner region used for the above calculation */ ! inline int getInnerRegionSize (void) { return m_innerRegionSize; } /** --- 75,89 ---- * @return the inner average per size */ ! inline double getInnerAvgPerSize (void) const { return m_innerAvgPerSize; } /** * Return the inner standard deviation (used for quality measurements) * @return the inner standard deviation */ ! inline double getInnerSDeviation (void) const { return m_innerSDeviation; } /** * Return the size of the inner region used for the above calculation * @return the size of the inner region used for the above calculation */ ! inline int getInnerRegionSize (void) const { return m_innerRegionSize; } /** *************** *** 91,95 **** * @return the threshold for cropping-while-resizing */ ! inline double threshold (void) { return m_threshold; } /** * Set the threshold for cropping-while-resizing --- 91,95 ---- * @return the threshold for cropping-while-resizing */ ! inline double threshold (void) const { return m_threshold; } /** * Set the threshold for cropping-while-resizing *************** *** 97,100 **** --- 97,112 ---- */ inline void threshold (double threshold) { m_threshold = threshold; } + + /** + * Set the optimize-image-setting + * @param optimize true if optimization is active + */ + inline void optimizeImage (bool optimizeImage) { m_optimizeImage = optimizeImage; } + /** + * Return the optimize-image-setting + * @return true if optimization is active + */ + inline bool optimizeImage (void) { return m_optimizeImage; } + protected: /** |
From: Herbert M. D. <he...@us...> - 2007-08-15 13:14:03
|
Update of /cvsroot/wavelet/Wavelet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16604 Modified Files: Image.cc PyramidTransform.cc configure configure.in Log Message: Crash fix in waveppm, bugfix in Image::variance(), minor polishin on imageresizer test. Index: configure =================================================================== RCS file: /cvsroot/wavelet/Wavelet/configure,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** configure 7 Aug 2007 17:00:59 -0000 1.3 --- configure 15 Aug 2007 13:13:57 -0000 1.4 *************** *** 1284,1289 **** --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] ! --disable-pfi Turn off pfi support --enable-debug Turn on debugging Some influential environment variables: --- 1284,1290 ---- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] ! --enable-pfi-check Turn on/off pfi support (on by default) --enable-debug Turn on debugging + --enable-trace Turn on excessive tracing messages Some influential environment variables: *************** *** 4344,4350 **** CHECK_PFI="yes" ! # Check whether --enable-debug was given. ! if test "${enable_debug+set}" = set; then ! enableval=$enable_debug; CHECK_PFI="no" else CHECK_PFI="yes" --- 4345,4351 ---- CHECK_PFI="yes" ! # Check whether --enable-pfi-check was given. ! if test "${enable_pfi_check+set}" = set; then ! enableval=$enable_pfi_check; CHECK_PFI="$enableval" else CHECK_PFI="yes" *************** *** 4353,4356 **** --- 4354,4358 ---- + if test $CHECK_PFI = yes; then if test "${ac_cv_header_pfi_h+set}" = set; then { echo "$as_me:$LINENO: checking for pfi.h" >&5 *************** *** 4546,4564 **** ! ! test "$CHECK_PFI" = "no" && PFI_DEF="" ! test "$CHECK_PFI" = "no" && PFI_LIB="" # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then ! enableval=$enable_debug; CXXDEBUG="-g -DDEBUG" test -z "$CXXOPT" && CXXOPT="" else - CXXDEBUG="-DDPRINTF" test -z "$CXXOPT" && CXXOPT="-O3" fi --- 4548,4582 ---- ! else ! PFI_DEF="" ! PFI_LIB="" ! fi + DEBUG="no" # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then ! enableval=$enable_debug; DEBUG="$enableval" ! fi ! ! ! if test $DEBUG = yes; then ! CXXDEBUG="-g -DDEBUG" test -z "$CXXOPT" && CXXOPT="" else test -z "$CXXOPT" && CXXOPT="-O3" + fi + + TRACE="no" + # Check whether --enable-trace was given. + if test "${enable_trace+set}" = set; then + enableval=$enable_trace; TRACE="$enableval" + fi + + if test $TRACE = no; then + CPPFLAGS="$CPPFLAGS -DDPRINTF" fi *************** *** 4569,4572 **** --- 4587,4591 ---- + GENERATE_LATEX=NO USE_PDFLATEX=NO Index: configure.in =================================================================== RCS file: /cvsroot/wavelet/Wavelet/configure.in,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** configure.in 7 Aug 2007 17:00:59 -0000 1.3 --- configure.in 15 Aug 2007 13:13:57 -0000 1.4 *************** *** 99,108 **** CHECK_PFI="yes" dnl Checks if we are going to enable the pfi library ! AC_ARG_ENABLE(debug, ! [--disable-pfi Turn off pfi support], ! CHECK_PFI="no", CHECK_PFI="yes" ) dnl Checks for pfi header. AC_CHECK_HEADER(pfi.h, --- 99,109 ---- CHECK_PFI="yes" dnl Checks if we are going to enable the pfi library ! AC_ARG_ENABLE(pfi-check, ! [--enable-pfi-check Turn on/off pfi support (on by default)], ! CHECK_PFI="$enableval", CHECK_PFI="yes" ) + if test $CHECK_PFI = yes; then dnl Checks for pfi header. AC_CHECK_HEADER(pfi.h, *************** *** 114,132 **** PFI_LIB="" ) ! ! test "$CHECK_PFI" = "no" && PFI_DEF="" ! test "$CHECK_PFI" = "no" && PFI_LIB="" AC_SUBST(PFI_DEF) AC_SUBST(PFI_LIB) dnl Checks if we are going to enable debugging AC_ARG_ENABLE(debug, [--enable-debug Turn on debugging], CXXDEBUG="-g -DDEBUG" ! test -z "$CXXOPT" && CXXOPT="", ! CXXDEBUG="-DDPRINTF" test -z "$CXXOPT" && CXXOPT="-O3" ! ) AC_SUBST(CXXOPT) AC_SUBST(CXXDEBUG) --- 115,150 ---- PFI_LIB="" ) ! else ! PFI_DEF="" ! PFI_LIB="" ! fi AC_SUBST(PFI_DEF) AC_SUBST(PFI_LIB) + DEBUG="no" dnl Checks if we are going to enable debugging AC_ARG_ENABLE(debug, [--enable-debug Turn on debugging], + DEBUG="$enableval") + + if test $DEBUG = yes; then CXXDEBUG="-g -DDEBUG" ! test -z "$CXXOPT" && CXXOPT="" ! else test -z "$CXXOPT" && CXXOPT="-O3" ! fi ! ! TRACE="no" ! dnl Checks if we are going to enable debugging ! AC_ARG_ENABLE(trace, ! [--enable-trace Turn on excessive tracing messages], ! TRACE="$enableval") ! ! if test $TRACE = no; then ! CPPFLAGS="$CPPFLAGS -DDPRINTF" ! fi ! ! AC_SUBST(CXXOPT) AC_SUBST(CXXDEBUG) Index: PyramidTransform.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PyramidTransform.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyramidTransform.cc 7 Aug 2007 17:00:59 -0000 1.6 --- PyramidTransform.cc 15 Aug 2007 13:13:57 -0000 1.7 *************** *** 120,124 **** } } ! DELETE (vSize); ! DELETE (hSize); } --- 120,124 ---- } } ! DELETEAR (vSize); ! DELETEAR (hSize); } Index: Image.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Image.cc,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Image.cc 10 Aug 2007 17:55:45 -0000 1.25 --- Image.cc 15 Aug 2007 13:13:57 -0000 1.26 *************** *** 161,165 **** coeff avg = abs? this->aaverage (fromY, fromX, lower, right) : this->saverage (fromY, fromX, lower, right); ! return variance (fromY, fromX, toY, toX, abs, avg); } --- 161,165 ---- coeff avg = abs? this->aaverage (fromY, fromX, lower, right) : this->saverage (fromY, fromX, lower, right); ! return variance (fromY, fromX, toY, toX, avg, abs); } |
From: Herbert M. D. <he...@us...> - 2007-08-15 13:14:03
|
Update of /cvsroot/wavelet/Wavelet/test In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16604/test Modified Files: imageresizer.cc prod_18_schuh1.jpg Log Message: Crash fix in waveppm, bugfix in Image::variance(), minor polishin on imageresizer test. Index: imageresizer.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/imageresizer.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** imageresizer.cc 10 Aug 2007 17:55:45 -0000 1.2 --- imageresizer.cc 15 Aug 2007 13:13:58 -0000 1.3 *************** *** 39,43 **** //int white[3] = { 255, 255, 255 }; ! TEST_NO_EXCEPTION (img->read ("prod_18_schuh1.jpg")); // 300x220 int red[3] = { 255, 0, 0 }; --- 39,43 ---- //int white[3] = { 255, 255, 255 }; ! TEST_NO_EXCEPTION (img->read ("prod_18_schuh1.jpg")); // 300x280 int red[3] = { 255, 0, 0 }; *************** *** 52,56 **** cout << "score: " << 20000 * ir.getInnerAvgPerSize () << endl; ! TEST_NO_EXCEPTION (result->write("out.jpg")); //TEST_NO_EXCEPTION (result = ir.resize(400, 500)); --- 52,57 ---- cout << "score: " << 20000 * ir.getInnerAvgPerSize () << endl; ! TEST_NO_EXCEPTION (result->write("rescaled.jpg")); ! DELETE (result); //TEST_NO_EXCEPTION (result = ir.resize(400, 500)); *************** *** 61,65 **** TEST_NO_EXCEPTION (result = ir.resize(0, 0)); cout << "score: " << 20000 * ir.getInnerAvgPerSize () << endl; ! TEST_NO_EXCEPTION (result->write("aus.jpg")); --- 62,71 ---- TEST_NO_EXCEPTION (result = ir.resize(0, 0)); cout << "score: " << 20000 * ir.getInnerAvgPerSize () << endl; ! TEST_NO_EXCEPTION (result->write("autocropped.jpg")); ! DELETE (result); ! ! TEST_NO_EXCEPTION (result = img->fitInto (80, 300, red)); ! TEST_NO_EXCEPTION (result->write("simple.jpg")); ! DELETE (result); Index: prod_18_schuh1.jpg =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/prod_18_schuh1.jpg,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsuSmLrM and /tmp/cvs0d4o7O differ |
From: Herbert M. D. <he...@us...> - 2007-08-15 13:14:03
|
Update of /cvsroot/wavelet/Wavelet/tools In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16604/tools Modified Files: waveppm.cc Log Message: Crash fix in waveppm, bugfix in Image::variance(), minor polishin on imageresizer test. Index: waveppm.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/waveppm.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** waveppm.cc 7 Aug 2007 17:01:01 -0000 1.5 --- waveppm.cc 15 Aug 2007 13:13:58 -0000 1.6 *************** *** 185,189 **** } - DELETE (ppm); DELETE (beautified); } --- 185,188 ---- *************** *** 196,199 **** --- 195,199 ---- } DELETEAR (transforms); + DELETE (ppm); return 0; |
From: Herbert M. D. <he...@us...> - 2007-08-10 18:38:21
|
Update of /cvsroot/wavelet/Wavelet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv22869 Modified Files: ImageResizer.cc Log Message: Minor fix for the calculation of image stats if image optimization is turned off. Index: ImageResizer.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ImageResizer.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ImageResizer.cc 10 Aug 2007 17:55:45 -0000 1.2 --- ImageResizer.cc 10 Aug 2007 18:38:14 -0000 1.3 *************** *** 226,236 **** outerSDev = sqrt (outerVariance); - - /* we calculate this at the end of the image optimization if this is set */ - if (!m_optimizeImage) - { - m_innerSDeviation = innerSDev; - m_innerAvgPerSize = innerAvg / m_innerRegionSize; - } } --- 226,229 ---- *************** *** 387,390 **** --- 380,394 ---- int nDiscardCols = (int)(m_cropMaxCols * m_colsMapping + 0.5); + if (!m_optimizationCalculated) + { + coeff innerAvg, innerSDev; + calcInnerStats (innerAvg, innerSDev, + nDiscardRows, nDiscardCols, + m_maxDetail->rows () - nDiscardRows, + m_maxDetail->cols () - nDiscardCols); + m_innerSDeviation = innerSDev; + m_innerAvgPerSize = innerAvg / m_innerRegionSize; + } + if (m_cropWhat != CROP_AUTOMATICALLY) { |
From: Herbert M. D. <he...@us...> - 2007-08-10 17:55:54
|
Update of /cvsroot/wavelet/Wavelet/WTools In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6309/WTools Modified Files: ImageResizer.hh Log Message: Added a smart option to the ImageResizer, so that it can now do fully smart cropping. Index: ImageResizer.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WTools/ImageResizer.hh,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ImageResizer.hh 7 Aug 2007 17:01:00 -0000 1.1 --- ImageResizer.hh 10 Aug 2007 17:55:45 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * A class for advanced resizing of images, i.e. wavelet-based * techniques can be used to intelligently crop images to fit + * + * This class will only discard background pixels if the image is + * shrunk. */ class ImageResizer *************** *** 34,37 **** --- 37,42 ---- * (else the a smaller image size will be chosen if the aspect ratio * does not match) + * @param optimizeImage if set to true, we will try to locate the actual + * contents regardless of whether the target dimensions fit or not * @param threshold the threshold for the aggressiveness of the * cropping (< 1), the higher the more aggressive, default is 0.001 *************** *** 40,44 **** * @return a new rescaled image */ ImageResizer (const ColorImage &img, FilterSet &flt, int *fill = NULL, ! coeff threshold = 0.001, int scalingStrategy = 0); /** --- 45,50 ---- * @return a new rescaled image */ ImageResizer (const ColorImage &img, FilterSet &flt, int *fill = NULL, ! coeff threshold = 0.001, bool optimizeImage = false, ! int scalingStrategy = 0); /** *************** *** 50,54 **** * cropped to optimally fit in the new dimensions. The maximal percentage * of cropping as well as the thresholds for guessing insignificant areas ! * can be set. * The new dimensions must all be greater than zero. * @exception invalid_argument --- 56,62 ---- * cropped to optimally fit in the new dimensions. The maximal percentage * of cropping as well as the thresholds for guessing insignificant areas ! * can be set. If both dimensions are set to 0 and the optimization feature ! * is set, we get an auto-crop (i.e. the size is chosen from the image's ! * contents) * The new dimensions must all be greater than zero. * @exception invalid_argument *************** *** 73,76 **** --- 81,89 ---- */ inline double getInnerSDeviation (void) { return m_innerSDeviation; } + /** + * Return the size of the inner region used for the above calculation + * @return the size of the inner region used for the above calculation + */ + inline int getInnerRegionSize (void) { return m_innerRegionSize; } /** *************** *** 93,103 **** /** * Calculate average and standard deviation for the regions either top and * bottom or left and right (depending on the value of m_cropWhat) and the * region between for a given number of rows/columns symetrically from the * boundaries to the center of the image. ! * @param img the image on which to perform the stats ! * @param nVecs the number of vectors (i.e. rows/columns) over which to ! * calculate * @param outerAvg (out parameter) is where the calculated average for the * regions to crop is stored --- 106,167 ---- /** + * If the target dimensions do not match the source dimensions, determine + * how many rows or cols respectively can be discarded to further optimize + * the image. + * @param rows the target rows + * @param cols the target cols + * @return the number of rows / cols which can be discarded in the original + * image + */ + int fixDimensions (int rows, int cols); + + /** + * Determine how many rows and cols can be discarded regardless of the + * target dimensions. This is calculated once within ::resize(), so that + * if more than one target size is required by repeated resizing operations + * little or no further effort is necessary after the first operation. + */ + void calcOptimization (void); + + /** + * Calculate the average and variance for an outer region of the + * (internal) maxDetail image. This is needed to see whether we can + * discard this outer region or not. + * @param avg the calculated average + * @param variance the calculated variance + * @param firstTop the first top of the frame + * @param firstLeft the first left of the frame + * @param firstBottom the first bottom of the frame + * @param firstRight the first right of the frame + * @param secondTop the second top of the frame + * @param secondLeft the second left of the frame + * @param secondBottom the second bottom of the frame + * @param secondRight the second right of the frame + */ + void calcOuterStats (coeff &avg, coeff &variance, int firstTop, int firstLeft, + int firstBottom, int firstRight, int secondTop, int secondLeft, + int secondBottom, int secondRight); + + /** + * Calculate the average and variance for an inner region of the + * (internal) maxDetail image. This is needed to see whether we can + * discard the region around it or not. + * @param avg the calculated average + * @param variance the calculated variance + * @param top the top of the inner region + * @param left the left of the inner region + * @param bottom the bottom of the inner region + * @param right the right of the inner region + */ + void calcInnerStats (coeff &avg, coeff &sDev, + int top, int left, int bottom, int right); + + /** * Calculate average and standard deviation for the regions either top and * bottom or left and right (depending on the value of m_cropWhat) and the * region between for a given number of rows/columns symetrically from the * boundaries to the center of the image. ! * @param nRows the number of rows over which to calculate ! * @param nCols the number of rows over which to calculate * @param outerAvg (out parameter) is where the calculated average for the * regions to crop is stored *************** *** 109,123 **** * deviation for the region between is stored */ ! void calcStats (Image &img, int nVecs, coeff &outerAvg, coeff &outerSDev, ! coeff &innerAvg, coeff &innerSDev); /** ! * Prepare the result image and the transform ! * @param rows the number of rows ! * @param cols the number of cols * @param steps the number of decomposition steps - * @return the max values image from the detail areas */ ! Image *prepareImage (int rows, int cols, int steps); /** --- 173,184 ---- * deviation for the region between is stored */ ! void calcStats (int nRows, int nCols, coeff &outerAvg, ! coeff &outerSDev, coeff &innerAvg, coeff &innerSDev); /** ! * Calculate the maxDetail image for the statistics * @param steps the number of decomposition steps */ ! void genMaxDetail (int steps); /** *************** *** 126,150 **** * @param rows the number of rows * @param cols the number of cols ! * @param nDiscardEach the number of rows/cols to discard on each side ! * (i.e. we actually discard 2 * nDiscard overall); if less than or equal * to zero, nothing will be discarded */ ! void doResizeImage (int rows, int cols, int nDiscardEach); const ColorImage &m_image; ! ColorImage *m_resized; FilterSet &m_filter; - WaveletTransform *m_transform; float m_qRows; float m_qCols; - float m_factor; - int m_useRows; - int m_useCols; int *m_fill; int m_scalingStrategy; double m_innerAvgPerSize; double m_innerSDeviation; coeff m_threshold; ! enum { CROP_COLS, CROP_ROWS } m_cropWhat; }; --- 187,220 ---- * @param rows the number of rows * @param cols the number of cols ! * @param discardRows the number of rows to discard on each side ! * (i.e. we actually discard 2 * discardRows overall); if less than or equal ! * to zero, nothing will be discarded ! * @param discardCols the number of rows to discard on each side ! * (i.e. we actually discard 2 * discardCols overall); if less than or equal * to zero, nothing will be discarded + * @return the result image */ ! ColorImage* doResizeImage (int rows, int cols, int discardRows, int discardCols); const ColorImage &m_image; ! Image *m_maxDetail; FilterSet &m_filter; float m_qRows; float m_qCols; int *m_fill; int m_scalingStrategy; double m_innerAvgPerSize; double m_innerSDeviation; + int m_innerRegionSize; coeff m_threshold; ! bool m_optimizeImage; ! bool m_optimizationCalculated; ! int m_cropMaxRows; ! int m_cropMaxCols; ! double m_rowsMapping; ! double m_colsMapping; ! enum { ! CROP_COLS, CROP_ROWS, CROP_BOTH_OR_NONE, CROP_AUTOMATICALLY ! } m_cropWhat; }; |
From: Herbert M. D. <he...@us...> - 2007-08-10 17:55:54
|
Update of /cvsroot/wavelet/Wavelet/WImage In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6309/WImage Modified Files: Image.hh Log Message: Added a smart option to the ImageResizer, so that it can now do fully smart cropping. Index: Image.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage/Image.hh,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Image.hh 7 Aug 2007 17:01:00 -0000 1.16 --- Image.hh 10 Aug 2007 17:55:45 -0000 1.17 *************** *** 456,459 **** --- 456,475 ---- * region. Use this method if you want statistics on a region in the * image. For other cases you may want to use ImageInformation::variance(). + * This version of the method takes the average (either absolute or signed) as + * argument so that it does not need to be calculated again. + * @param fromY the first point's row + * @param fromX the first point's col + * @param toY the second point's row (-1 if lower image border) + * @param toX the second point's col (-1 if right image border) + * @param avg the average for the region + * @param abs true if signs are discarded + * @return the square variance */ + virtual coeff variance (int fromY, int fromX, int toY, int toX, + coeff avg, bool abs) 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 * @param fromX the first point's col |
From: Herbert M. D. <he...@us...> - 2007-08-10 17:55:54
|
Update of /cvsroot/wavelet/Wavelet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6309 Modified Files: Image.cc ImageResizer.cc Log Message: Added a smart option to the ImageResizer, so that it can now do fully smart cropping. Index: ImageResizer.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ImageResizer.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ImageResizer.cc 7 Aug 2007 17:00:58 -0000 1.1 --- ImageResizer.cc 10 Aug 2007 17:55:45 -0000 1.2 *************** *** 25,33 **** ImageResizer::ImageResizer(const ColorImage &img, FilterSet &flt, ! int *fill, coeff threshold, int scalingStrategy) ! : m_image (img), m_resized (NULL), m_filter (flt), m_transform (NULL), ! m_qRows (0), m_qCols (0), m_factor (0), m_useRows (0), m_useCols (0), m_scalingStrategy (scalingStrategy), m_innerAvgPerSize (0), ! m_innerSDeviation (0), m_threshold (threshold) { if (fill == NULL) --- 25,36 ---- ImageResizer::ImageResizer(const ColorImage &img, FilterSet &flt, ! int *fill, coeff threshold, bool optimizeImage, ! int scalingStrategy) ! : m_image (img), m_maxDetail (NULL), m_filter (flt), ! m_qRows (0), m_qCols (0), m_scalingStrategy (scalingStrategy), m_innerAvgPerSize (0), ! m_innerSDeviation (0), m_innerRegionSize (0), m_threshold (threshold), ! m_optimizeImage (optimizeImage), m_optimizationCalculated (false), ! m_cropMaxRows (0), m_cropMaxCols (0), m_rowsMapping (0), m_colsMapping (0) { if (fill == NULL) *************** *** 48,93 **** ImageResizer::~ImageResizer(void) { - DELETENOTNULL (m_resized); DELETENOTNULLAR (m_fill); ! } ! ! void ! ImageResizer::calcDimensions (int rows, int cols) ! { ! /* find the best fit: we want either the rows or the cols to ! * fit exactly so that the remaining dimension can be cropped */ ! m_useRows = (int)floor (m_image.rows () * m_qCols + 0.5); ! m_useCols = (int)floor (m_image.cols () * m_qRows + 0.5); - if (m_useRows >= rows) - { - m_factor = m_qCols; - m_useCols = cols; - m_cropWhat = CROP_ROWS; - } - else - { - m_factor = m_qRows; - m_useRows = rows; - m_cropWhat = CROP_COLS; - } } ! // TODO: calculate image quality heuristics here! ! Image * ! ImageResizer::prepareImage (int rows, int cols, int steps) { - /* m_factor delivers us an image of same size or larger than - * specified by rows/cols */ - m_resized = m_image.scale (m_factor, m_scalingStrategy); - - assert (m_resized->rows() >= rows); - assert (m_resized->cols() >= cols); - Image *channel; ! ColorImage *tmp = m_resized->clone (); ! Image *maxDetail = NULL; int oldY = tmp->rows(); int oldX = tmp->cols(); /* perform a wavelet transform on all channels and from this calculate the --- 51,67 ---- ImageResizer::~ImageResizer(void) { DELETENOTNULLAR (m_fill); ! DELETENOTNULL (m_maxDetail); } ! void ! ImageResizer::genMaxDetail (int steps) { Image *channel; ! ColorImage *tmp = m_image.clone (); int oldY = tmp->rows(); int oldX = tmp->cols(); + WaveletTransform *transform = NULL; /* perform a wavelet transform on all channels and from this calculate the *************** *** 95,106 **** for (int i = 0; i < tmp->colors (); i++) { ! DELETENOTNULL (m_transform); ! m_transform = NEW (PyramidTransform (tmp->channel (i), m_filter)); ! m_transform->expandImage (); ! m_transform->analysis (steps); ! channel = m_transform->highMax (steps); if (i == 0) { ! maxDetail = channel->clone (); } else --- 69,80 ---- for (int i = 0; i < tmp->colors (); i++) { ! DELETENOTNULL (transform); ! transform = NEW (PyramidTransform (tmp->channel (i), m_filter)); ! transform->expandImage (); ! transform->analysis (steps); ! channel = transform->highMax (steps); if (i == 0) { ! m_maxDetail = channel->clone (); } else *************** *** 108,114 **** for (int j = 0; j < channel->size(); j++) { ! if (channel->at (j) > maxDetail->at (j)) { ! maxDetail->to (j, channel->at (j)); } } --- 82,88 ---- for (int j = 0; j < channel->size(); j++) { ! if (channel->at (j) > m_maxDetail->at (j)) { ! m_maxDetail->to (j, channel->at (j)); } } *************** *** 119,307 **** /* now restore the old image's ratio for the one produced from the max * coefficients in the detail areas */ ! maxDetail->resize(maxDetail->rows() * oldY / tmp->rows(), ! maxDetail->cols() * oldX / tmp->cols()); ! ! DELETE(tmp); ! DELETE (m_transform); ! return maxDetail; } void ! ImageResizer::doResizeImage(int rows, int cols, int nDiscardEach) { ! ColorImage *tmp = NULL; ! if (nDiscardEach > 0) { ! int fromY = m_cropWhat == CROP_COLS? 0: nDiscardEach; ! int fromX = m_cropWhat == CROP_ROWS? 0: nDiscardEach; ! int sizeY = m_cropWhat == CROP_COLS? ! m_resized->rows (): m_resized->rows () - 2 * nDiscardEach; ! int sizeX = m_cropWhat == CROP_ROWS? ! m_resized->cols (): m_resized->cols () - 2 * nDiscardEach; ! // TOOD this is far from optimal, but let's just see how it works first ! tmp = m_resized->crop (fromY, fromX, sizeY, sizeX); ! DELETE (m_resized); } else { ! tmp = m_resized; } - m_resized = tmp->fitInto (rows, cols, m_fill, m_scalingStrategy); - DELETE (tmp); } ! static coeff ! absVariance (int fromY, int fromX, int toY, int toX, Image &img, coeff avg) { ! int nVals = 0; ! int lower = (toY < 0)? img.rows (): toY; ! int right = (toX < 0)? img.cols (): toX; ! coeff ret = 0.0; ! coeff tmp; ! for (int y = (fromY < 0? 0: fromY); y < lower && y < img.rows (); y++) { ! for (int x = (fromX < 0? 0: fromX); x < right && x < img.cols (); x++) ! { ! ++nVals; ! tmp = fabs (img.at (y, x)); ! tmp -= avg; ! ret += SQUARE (tmp); ! } } ! return ret / nVals; } void ! ImageResizer::calcStats(Image &img, int nVecs, coeff &outerAvg, ! coeff &outerSDev, coeff &innerAvg, coeff &innerSDev) { ! // we're not calculating the *REAL* standard deviation here since we have ! // independent regions on which we calculate the averages which are used ! // for calculating the standard deviation, but what we get here will ! // normally come close enough to the real thing ! // OPTIMIZE ME: the calculation of the average is duplicate here ! coeff outerVariance; ! coeff innerVariance; ! if (m_cropWhat == CROP_COLS) ! { ! int top = 0; ! int bottom = -1; ! int firstLeft = 0; ! int firstRight = nVecs; ! int secondLeft = img.cols () - nVecs; ! int secondRight = -1; ! outerAvg = (img.aaverage (top, firstLeft, bottom, firstRight) ! + img.aaverage (top, secondLeft, bottom, secondRight)) / 2.0; ! outerVariance = (absVariance (top, firstLeft, bottom, firstRight, ! img, outerAvg) ! + absVariance (top, secondLeft, bottom, secondRight, ! img, outerAvg)) / 2; ! innerAvg = img.aaverage (top, firstRight, bottom, secondLeft); ! innerVariance = absVariance (top, firstRight, bottom, secondLeft, ! img, innerAvg); } ! else { ! int left = 0; ! int right = -1; ! int firstTop = 0; ! int firstBottom = nVecs; ! int secondTop = img.rows () - nVecs; ! int secondBottom = -1; ! outerAvg = (img.aaverage (firstTop, left, firstBottom, right) ! + img.aaverage (secondTop, left, secondBottom, right)) / 2.0; ! outerVariance = (absVariance (firstTop, left, firstBottom, right, ! img, outerAvg) ! + absVariance (secondTop, left, secondBottom, right, ! img, outerAvg)) / 2.0; ! innerAvg = img.aaverage (firstBottom, left, secondTop, right); ! innerVariance = absVariance (firstBottom, left, secondTop, right, ! img, innerAvg); } - outerSDev = sqrt (outerVariance); - innerSDev = sqrt (innerVariance); } ! ColorImage* ! ImageResizer::resize(int rows, int cols, int steps) { ! if (rows <= 0 || cols <= 0) { ! throw invalid_argument ("rows or columns arg is <= zero"); } ! m_qRows = (float)rows / m_image.rows(); ! m_qCols = (float)cols / m_image.cols(); ! m_factor = m_qRows; ! ! /* no dimension change necessary? do the job and go away */ ! if (fabs (m_qRows - m_qCols) < COEFF_EPSILON) { ! return m_image.scale (m_factor, m_scalingStrategy); } ! calcDimensions (rows, cols); ! ! Image *maxDetail = prepareImage (rows, cols, steps); coeff outerAvg; coeff outerSDev; coeff innerAvg; coeff innerSDev; - // maxDetail->rows () / maxDetali->cols () == ratio; double ratio = (double)rows / (double)cols; ! double mapping; int maxI = 0; if (m_cropWhat == CROP_COLS) { ! //std::cout << "cropping columns..." << std::endl; ! // ratio = maxDetail->rows () / (maxDetail->cols () - 2 * maxI) ! // ratio * (maxDetail->cols () - 2 * maxI) = maxDetail->rows () ! // maxDetail->cols () - 2 * maxI = maxDetail->rows () / ratio ! maxI = - (int)(maxDetail->rows () / ratio - maxDetail->cols () + 0.5); ! mapping = m_resized->cols () / maxDetail->cols (); ! assert (maxI <= maxDetail->cols ()); } else { ! //std::cout << "cropping rows..." << std::endl; ! // ratio = (maxDetail->rows () - 2 * maxI) / maxDetail->cols () ! // ratio * maxDetail->cols () = maxDetail->rows () - 2 * maxI ! maxI = - (int)(maxDetail->cols () * ratio - maxDetail->rows () + 0.5); ! mapping = m_resized->rows () / maxDetail->rows (); ! assert (maxI <= maxDetail->rows ()); } - maxI /= 2; - //std::cout << "maxI: " << maxI << ", ratio: " << ratio << std::endl; - - int nDiscardEach = 0; double outerByInner; - cout.setf (ios::fixed, ios::floatfield); - for (int i = 1; i < maxI && nDiscardEach == 0; i++) { ! calcStats(*maxDetail, i, outerAvg, outerSDev, innerAvg, innerSDev); outerByInner = outerAvg / innerAvg; ! cout.setf (ios::fixed, ios::floatfield); ! /*cout << "i: " << std::setw (2) << i << std::setw (2) << ", oa: " << outerAvg << std::setw (2) << ", os: " << outerSDev --- 93,344 ---- /* now restore the old image's ratio for the one produced from the max * coefficients in the detail areas */ ! m_maxDetail->resize(m_maxDetail->rows() * oldY / tmp->rows(), ! m_maxDetail->cols() * oldX / tmp->cols()); ! m_colsMapping = m_image.cols () / m_maxDetail->cols (); ! m_rowsMapping = m_image.rows () / m_maxDetail->rows (); ! DELETE (tmp); ! DELETENOTNULL (transform); } void ! ImageResizer::calcDimensions (int rows, int cols) { ! /* we determine the optimal size from the image, no factors are needed */ ! if (rows == 0 && cols == 0 && m_optimizeImage) { ! m_cropWhat = CROP_AUTOMATICALLY; ! return; ! } ! m_qRows = (float)rows / m_image.rows(); ! m_qCols = (float)cols / m_image.cols(); ! /* find the best fit: we want either the rows or the cols to ! * fit exactly so that the remaining dimension can be cropped */ ! if ((int)floor (m_image.rows () * m_qCols + 0.5) >= rows) ! { ! m_cropWhat = CROP_ROWS; ! } ! else if ((int)floor (m_image.cols () * m_qRows + 0.5) > cols) ! { ! m_cropWhat = CROP_COLS; } else { ! m_cropWhat = CROP_BOTH_OR_NONE; } } ! ColorImage* ! ImageResizer::doResizeImage(int rows, int cols, int discardRows, int discardCols) { ! ColorImage *tmp = NULL; ! if (discardRows > 0 || discardCols > 0) ! { ! int fromY = discardRows; ! int fromX = discardCols; ! int sizeY = m_image.rows () - 2 * discardRows; ! int sizeX = m_image.cols () - 2 * discardCols; ! ! /* TOOD this is far from optimal, but let's just see how it works first */ ! tmp = m_image.crop (fromY, fromX, sizeY, sizeX); ! } ! else { ! tmp = m_image.clone (); } ! ! if (m_cropWhat == CROP_AUTOMATICALLY) ! { ! return tmp; ! } ! ! ColorImage *result = tmp->fitInto (rows, cols, m_fill, m_scalingStrategy); ! DELETE (tmp); ! return result; } void ! ImageResizer::calcOuterStats (coeff &avg, coeff &variance, ! int firstTop, int firstLeft, ! int firstBottom, int firstRight, ! int secondTop, int secondLeft, ! int secondBottom, int secondRight) { ! avg = (m_maxDetail->aaverage (firstTop, firstLeft, ! firstBottom, firstRight) ! + m_maxDetail->aaverage (secondTop, secondLeft, ! secondBottom, secondRight)) / 2.0; ! variance = (m_maxDetail->variance (firstTop, firstLeft, ! firstBottom, firstRight, ! avg, true) ! + m_maxDetail->variance (secondTop, secondLeft, ! secondBottom, secondRight, ! avg, true)) / 2; ! } ! void ! ImageResizer::calcInnerStats (coeff &avg, coeff &sDev, ! int top, int left, int bottom, int right) ! { ! avg = m_maxDetail->aaverage (top, left, bottom, right); ! sDev = sqrt (m_maxDetail->variance (top, left, bottom, right, avg, true)); ! m_innerRegionSize = (m_maxDetail->rows () - 2 * top) ! * (m_maxDetail->cols () - 2 * left); ! } ! void ! ImageResizer::calcStats(int nRows, int nCols, coeff &outerAvg, ! coeff &outerSDev, coeff &innerAvg, coeff &innerSDev) ! { ! coeff outerVariance = 0; ! int valsOuterCols = 0; ! int secondTop = m_maxDetail->rows () - nRows; ! int secondLeft = m_maxDetail->cols () - nCols; ! int secondBottom = m_maxDetail->rows (); ! int secondRight = m_maxDetail->cols (); ! if (nCols > 0) ! { ! calcOuterStats (outerAvg, outerVariance, nRows, 0, secondTop, nCols, ! nRows, secondLeft, secondTop, secondRight); ! valsOuterCols = (secondTop - nRows) * nCols; } ! else if (nRows > 0) { ! calcOuterStats (outerAvg, outerVariance, 0, nCols, nRows, secondLeft, ! secondTop, nCols, secondBottom, secondRight); ! valsOuterCols = (nRows - secondTop) * (secondLeft - nCols); ! } ! else ! { ! throw invalid_argument ("can operate only one one out of rows/cols"); ! } ! calcInnerStats (innerAvg, innerSDev, nRows, nCols, secondTop, secondLeft); ! outerSDev = sqrt (outerVariance); ! /* we calculate this at the end of the image optimization if this is set */ ! if (!m_optimizeImage) ! { ! m_innerSDeviation = innerSDev; ! m_innerAvgPerSize = innerAvg / m_innerRegionSize; } } ! void ! ImageResizer::calcOptimization (void) { ! coeff outerAvg; ! coeff outerSDev; ! coeff innerAvg; ! coeff innerSDev; ! double outerByInner; ! int max = m_image.rows () / 2; ! ! for (int row = 1; row < max && m_cropMaxRows == 0; row++) { ! calcStats(row, 0, outerAvg, outerSDev, innerAvg, innerSDev); ! outerByInner = outerAvg / innerAvg; ! /*cout.setf (ios::fixed, ios::floatfield); ! cout << "row: " << std::setw (2) << row ! << std::setw (2) << ", oa: " << outerAvg ! << std::setw (2) << ", os: " << outerSDev ! << std::setw (2) << ", ia: " << innerAvg ! << std::setw (2) << ", is: " << innerSDev ! << std::setw (2) << ", o / row: " << outerByInner ! << endl;*/ ! if (outerByInner > m_threshold) ! { ! m_cropMaxRows = row - 1; ! } } ! max = m_image.cols () / 2; ! for (int col = 1; col < max && m_cropMaxCols == 0; col++) { ! calcStats(0, col, outerAvg, outerSDev, innerAvg, innerSDev); ! outerByInner = outerAvg / innerAvg; ! /*cout.setf (ios::fixed, ios::floatfield); ! cout << "col: " << std::setw (2) << col ! << std::setw (2) << ", oa: " << outerAvg ! << std::setw (2) << ", os: " << outerSDev ! << std::setw (2) << ", ia: " << innerAvg ! << std::setw (2) << ", is: " << innerSDev ! << std::setw (2) << ", o / col: " << outerByInner ! << endl;*/ ! if (outerByInner > m_threshold) ! { ! m_cropMaxCols = col - 1; ! } } + //cout << "calcOptimization: discard " << m_cropMaxRows + // << " rows and " << m_cropMaxCols << " cols." << endl; + calcInnerStats (innerAvg, innerSDev, m_cropMaxRows, m_cropMaxCols, + m_maxDetail->rows () - m_cropMaxRows, + m_maxDetail->cols () - m_cropMaxCols); ! m_innerSDeviation = innerSDev; ! m_innerAvgPerSize = innerAvg / m_innerRegionSize; ! } + int + ImageResizer::fixDimensions (int rows, int cols) + { coeff outerAvg; coeff outerSDev; coeff innerAvg; coeff innerSDev; + int nDiscardEach = 0; double ratio = (double)rows / (double)cols; ! double mapping = 0; int maxI = 0; if (m_cropWhat == CROP_COLS) { ! maxI = - (int)(m_maxDetail->rows () / ratio - m_maxDetail->cols () + 0.5) / 2; ! mapping = m_colsMapping; ! if (maxI < m_cropMaxCols) ! { ! return (int)(mapping * maxI); ! } ! maxI -= m_cropMaxCols; ! assert (maxI <= m_maxDetail->cols ()); ! } ! else if (m_cropWhat == CROP_ROWS) ! { ! maxI = - (int)(m_maxDetail->cols () * ratio - m_maxDetail->rows () + 0.5) / 2; ! mapping = m_rowsMapping; ! if (maxI < m_cropMaxRows) ! { ! return (int)(mapping * maxI); ! } ! maxI -= m_cropMaxRows; ! assert (maxI <= m_maxDetail->rows ()); } else { ! /* dimensions already match, nothing to do */ ! return 0; } double outerByInner; for (int i = 1; i < maxI && nDiscardEach == 0; i++) { ! calcStats (m_cropWhat == CROP_ROWS? i: 0, m_cropWhat == CROP_COLS? i: 0, ! outerAvg, outerSDev, innerAvg, innerSDev); outerByInner = outerAvg / innerAvg; ! /*cout.setf (ios::fixed, ios::floatfield); ! cout << "i: " << std::setw (2) << i << std::setw (2) << ", oa: " << outerAvg << std::setw (2) << ", os: " << outerSDev *************** *** 310,327 **** << std::setw (2) << ", o / i: " << outerByInner << endl;*/ - m_innerAvgPerSize = innerAvg / maxDetail->size (); - m_innerSDeviation = innerSDev; if (outerByInner > m_threshold) { ! nDiscardEach = (i > 0)? (int)(mapping * (i - 1)) : 0; } } ! doResizeImage(rows, cols, nDiscardEach); ! DELETE (maxDetail); - ColorImage *ret = m_resized; - m_resized = NULL; return ret; } --- 347,415 ---- << std::setw (2) << ", o / i: " << outerByInner << endl;*/ if (outerByInner > m_threshold) { ! nDiscardEach = (i > 1)? (int)(mapping * (i - 1)) : 0; } } + return nDiscardEach; + } ! ColorImage* ! ImageResizer::resize(int rows, int cols, int steps) ! { ! if ((rows <= 0 || cols <= 0) && !(rows == 0 && cols == 0 && m_optimizeImage)) ! { ! throw invalid_argument ("rows or columns arg is <= zero"); ! } ! calcDimensions (rows, cols); ! ! /* no dimension change necessary? do the job and go away */ ! if (m_cropWhat == CROP_BOTH_OR_NONE && !m_optimizeImage) ! { ! return m_image.scale (m_qRows, m_scalingStrategy); ! } ! ! /* We call genMaxDetail only once to save time */ ! if (m_maxDetail == NULL) ! { ! genMaxDetail (steps); ! } ! ! if (m_optimizeImage && !m_optimizationCalculated) ! { ! calcOptimization (); ! m_optimizationCalculated = true; ! } ! ! int nDiscard = fixDimensions (rows, cols); ! int nDiscardRows = (int)(m_cropMaxRows * m_rowsMapping + 0.5); ! int nDiscardCols = (int)(m_cropMaxCols * m_colsMapping + 0.5); ! ! if (m_cropWhat != CROP_AUTOMATICALLY) ! { ! /* can we crop even more than needed? */ ! if (m_image.rows () > rows && 2 * nDiscardRows > m_image.rows () - rows) ! { ! nDiscardRows = (m_image.rows () - rows) / 2; ! } ! if (m_image.cols () > cols && 2 * nDiscardCols > m_image.cols () - cols) ! { ! nDiscardCols = (m_image.cols () - cols) / 2; ! } ! ! /* have we gained some more to crop with differing dimensions? */ ! if (m_cropWhat == CROP_ROWS && nDiscard > nDiscardRows) ! { ! nDiscardRows = nDiscard; ! } ! else if (m_cropWhat == CROP_COLS && nDiscard > nDiscardCols) ! { ! nDiscardCols = nDiscard; ! } ! } ! ! ColorImage *ret = doResizeImage (rows, cols, nDiscardRows, nDiscardCols); return ret; } Index: Image.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Image.cc,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Image.cc 7 Aug 2007 17:00:58 -0000 1.24 --- Image.cc 10 Aug 2007 17:55:45 -0000 1.25 *************** *** 157,165 **** Image::variance (int fromY, int fromX, int toY, int toX, bool abs) const { - int nVals = 0; int lower = (toY < 0)? m_ysize: toY; int right = (toX < 0)? m_xsize: toX; coeff avg = abs? this->aaverage (fromY, fromX, lower, right) : this->saverage (fromY, fromX, lower, right); coeff ret = 0.0; coeff tmp; --- 157,174 ---- Image::variance (int fromY, int fromX, int toY, int toX, bool abs) const { int lower = (toY < 0)? m_ysize: toY; int right = (toX < 0)? m_xsize: toX; coeff avg = abs? this->aaverage (fromY, fromX, lower, right) : this->saverage (fromY, fromX, lower, right); + return variance (fromY, fromX, toY, toX, abs, avg); + } + + coeff + Image::variance (int fromY, int fromX, int toY, int toX, + coeff avg, bool abs) const + { + int nVals = 0; + int lower = (toY < 0)? m_ysize: toY; + int right = (toX < 0)? m_xsize: toX; coeff ret = 0.0; coeff tmp; |
From: Herbert M. D. <he...@us...> - 2007-08-10 17:55:54
|
Update of /cvsroot/wavelet/Wavelet/test In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6309/test Modified Files: imageresizer.cc Log Message: Added a smart option to the ImageResizer, so that it can now do fully smart cropping. Index: imageresizer.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/imageresizer.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** imageresizer.cc 7 Aug 2007 17:01:00 -0000 1.1 --- imageresizer.cc 10 Aug 2007 17:55:45 -0000 1.2 *************** *** 34,52 **** ColorImage *img = NEW (ColorImage ()); ColorImage * result; - TEST_NO_EXCEPTION (img->read ("prod_18_schuh1.jpg")); // 768x1024 //TEST_NO_EXCEPTION (img->read ("rita.jpg")); // 768x1024 //TEST_NO_EXCEPTION (img->read ("christina57.jpg")); // 594x448 //TEST_NO_EXCEPTION (img->read ("lena128.ppm")); // 128x128 //int white[3] = { 255, 255, 255 }; int red[3] = { 255, 0, 0 }; ! ImageResizer ir (*img, Haar, red, 0.001); //TEST_NO_EXCEPTION (result = ir.resize(100, 200)); - TEST_NO_EXCEPTION (result = ir.resize(80, 300)); - cout << "score: " << 20000 * ir.getInnerAvgPerSize () << endl; //TEST_NO_EXCEPTION (result = ir.resize(340, 300)); //TEST_NO_EXCEPTION (result = ir.resize(64, 64)); TEST_NO_EXCEPTION (result->write("out.jpg")); ! cout << "Test of class ImageResizer completed successfully.\n"; return 0; --- 34,67 ---- ColorImage *img = NEW (ColorImage ()); ColorImage * result; //TEST_NO_EXCEPTION (img->read ("rita.jpg")); // 768x1024 //TEST_NO_EXCEPTION (img->read ("christina57.jpg")); // 594x448 //TEST_NO_EXCEPTION (img->read ("lena128.ppm")); // 128x128 //int white[3] = { 255, 255, 255 }; + + TEST_NO_EXCEPTION (img->read ("prod_18_schuh1.jpg")); // 300x220 + int red[3] = { 255, 0, 0 }; ! ! ImageResizer ir (*img, Haar, red, 0.001, true); ! //TEST_NO_EXCEPTION (result = ir.resize(100, 200)); //TEST_NO_EXCEPTION (result = ir.resize(340, 300)); //TEST_NO_EXCEPTION (result = ir.resize(64, 64)); + + TEST_NO_EXCEPTION (result = ir.resize(80, 300)); + cout << "score: " << 20000 * ir.getInnerAvgPerSize () << endl; + TEST_NO_EXCEPTION (result->write("out.jpg")); ! //TEST_NO_EXCEPTION (result = ir.resize(400, 500)); ! //cout << "score: " << 20000 * ir.getInnerAvgPerSize () << endl; ! //cout << "Test of class ImageResizer completed successfully.\n"; ! //TEST_NO_EXCEPTION (result->write("aus.jpg")); ! ! TEST_NO_EXCEPTION (result = ir.resize(0, 0)); ! cout << "score: " << 20000 * ir.getInnerAvgPerSize () << endl; ! TEST_NO_EXCEPTION (result->write("aus.jpg")); ! ! return 0; |
Update of /cvsroot/wavelet/Wavelet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6566 Modified Files: AviReader.cc AviWriter.cc CoeffInformation.cc ColorBuffer.cc ColorImage.cc ColorVideo.cc FileName.cc Filter.cc GreymapWriter.cc Histogram.cc Image.cc ImageArray.cc ImageComparison.cc ImageDenoiser.cc ImageInformation.cc ImageVector.cc JpgReader.cc JpgWriter.cc Makefile.in Makefile.mdd Makefile.msc Makefile.watcomc MirrorPosition.cc NTree.cc PfcReader.cc PfcWriter.cc PfgReader.cc PfgWriter.cc PgmReader.cc PgmWriter.cc PixmapFile.cc PixmapWriter.cc PpmReader.cc PpmWriter.cc PyramidTransform.cc PyramidTree.cc RawReader.cc RawWriter.cc StillImage.cc VidReader.cc VidWriter.cc VideoArray.cc VideoFrame.cc VideoWriter.cc Wavelet.cc configure configure.in debug.cc ppmlib.cc tools.cc wave_version.h Added Files: ImageResizer.cc Log Message: Various bugfixes, added ImageResizer tool class which allows smart cropping of color images (not very sophisticated yet). Index: ImageVector.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ImageVector.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ImageVector.cc 10 Aug 2005 09:35:23 -0000 1.3 --- ImageVector.cc 7 Aug 2007 17:00:58 -0000 1.4 *************** *** 14,17 **** --- 14,18 ---- #endif #include <stdexcept> + #include <cmath> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) *************** *** 50,51 **** --- 51,62 ---- } + coeff + ImageVector::weight(void) + { + coeff rc = 0; + for (int i = 0; i < size(); i++) { + rc += fabs (this->at(i)); + } + return rc; + } + --- NEW FILE: ImageResizer.cc --- /* * Implementation of class ImageResizer * * $Date: 2007/08/07 17:00:58 $ * $Revision: 1.1 $ * */ #include "Wave/PyramidTransform.hh" #include "WTools/ImageResizer.hh" #ifdef _WIN32_WCE #undef DELETE #endif #include <cmath> #include <cassert> #include <iostream> #include <iomanip> #include "WImage/miscdefs.h" #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) using namespace std; #endif ImageResizer::ImageResizer(const ColorImage &img, FilterSet &flt, int *fill, coeff threshold, int scalingStrategy) : m_image (img), m_resized (NULL), m_filter (flt), m_transform (NULL), m_qRows (0), m_qCols (0), m_factor (0), m_useRows (0), m_useCols (0), m_scalingStrategy (scalingStrategy), m_innerAvgPerSize (0), m_innerSDeviation (0), m_threshold (threshold) { if (fill == NULL) { m_fill = fill; } else { m_fill = new int [m_image.colors ()]; for (int i = 0; i < m_image.colors (); i++) { m_fill[i] = fill[i]; } } } ImageResizer::~ImageResizer(void) { DELETENOTNULL (m_resized); DELETENOTNULLAR (m_fill); } void ImageResizer::calcDimensions (int rows, int cols) { /* find the best fit: we want either the rows or the cols to * fit exactly so that the remaining dimension can be cropped */ m_useRows = (int)floor (m_image.rows () * m_qCols + 0.5); m_useCols = (int)floor (m_image.cols () * m_qRows + 0.5); if (m_useRows >= rows) { m_factor = m_qCols; m_useCols = cols; m_cropWhat = CROP_ROWS; } else { m_factor = m_qRows; m_useRows = rows; m_cropWhat = CROP_COLS; } } // TODO: calculate image quality heuristics here! Image * ImageResizer::prepareImage (int rows, int cols, int steps) { /* m_factor delivers us an image of same size or larger than * specified by rows/cols */ m_resized = m_image.scale (m_factor, m_scalingStrategy); assert (m_resized->rows() >= rows); assert (m_resized->cols() >= cols); Image *channel; ColorImage *tmp = m_resized->clone (); Image *maxDetail = NULL; int oldY = tmp->rows(); int oldX = tmp->cols(); /* perform a wavelet transform on all channels and from this calculate the * image containing the max values from all channels' detail areas */ for (int i = 0; i < tmp->colors (); i++) { DELETENOTNULL (m_transform); m_transform = NEW (PyramidTransform (tmp->channel (i), m_filter)); m_transform->expandImage (); m_transform->analysis (steps); channel = m_transform->highMax (steps); if (i == 0) { maxDetail = channel->clone (); } else { for (int j = 0; j < channel->size(); j++) { if (channel->at (j) > maxDetail->at (j)) { maxDetail->to (j, channel->at (j)); } } } DELETE (channel); } /* now restore the old image's ratio for the one produced from the max * coefficients in the detail areas */ maxDetail->resize(maxDetail->rows() * oldY / tmp->rows(), maxDetail->cols() * oldX / tmp->cols()); DELETE(tmp); DELETE (m_transform); return maxDetail; } void ImageResizer::doResizeImage(int rows, int cols, int nDiscardEach) { ColorImage *tmp = NULL; if (nDiscardEach > 0) { int fromY = m_cropWhat == CROP_COLS? 0: nDiscardEach; int fromX = m_cropWhat == CROP_ROWS? 0: nDiscardEach; int sizeY = m_cropWhat == CROP_COLS? m_resized->rows (): m_resized->rows () - 2 * nDiscardEach; int sizeX = m_cropWhat == CROP_ROWS? m_resized->cols (): m_resized->cols () - 2 * nDiscardEach; // TOOD this is far from optimal, but let's just see how it works first tmp = m_resized->crop (fromY, fromX, sizeY, sizeX); DELETE (m_resized); } else { tmp = m_resized; } m_resized = tmp->fitInto (rows, cols, m_fill, m_scalingStrategy); DELETE (tmp); } static coeff absVariance (int fromY, int fromX, int toY, int toX, Image &img, coeff avg) { int nVals = 0; int lower = (toY < 0)? img.rows (): toY; int right = (toX < 0)? img.cols (): toX; coeff ret = 0.0; coeff tmp; for (int y = (fromY < 0? 0: fromY); y < lower && y < img.rows (); y++) { for (int x = (fromX < 0? 0: fromX); x < right && x < img.cols (); x++) { ++nVals; tmp = fabs (img.at (y, x)); tmp -= avg; ret += SQUARE (tmp); } } return ret / nVals; } void ImageResizer::calcStats(Image &img, int nVecs, coeff &outerAvg, coeff &outerSDev, coeff &innerAvg, coeff &innerSDev) { // we're not calculating the *REAL* standard deviation here since we have // independent regions on which we calculate the averages which are used // for calculating the standard deviation, but what we get here will // normally come close enough to the real thing // OPTIMIZE ME: the calculation of the average is duplicate here coeff outerVariance; coeff innerVariance; if (m_cropWhat == CROP_COLS) { int top = 0; int bottom = -1; int firstLeft = 0; int firstRight = nVecs; int secondLeft = img.cols () - nVecs; int secondRight = -1; outerAvg = (img.aaverage (top, firstLeft, bottom, firstRight) + img.aaverage (top, secondLeft, bottom, secondRight)) / 2.0; outerVariance = (absVariance (top, firstLeft, bottom, firstRight, img, outerAvg) + absVariance (top, secondLeft, bottom, secondRight, img, outerAvg)) / 2; innerAvg = img.aaverage (top, firstRight, bottom, secondLeft); innerVariance = absVariance (top, firstRight, bottom, secondLeft, img, innerAvg); } else { int left = 0; int right = -1; int firstTop = 0; int firstBottom = nVecs; int secondTop = img.rows () - nVecs; int secondBottom = -1; outerAvg = (img.aaverage (firstTop, left, firstBottom, right) + img.aaverage (secondTop, left, secondBottom, right)) / 2.0; outerVariance = (absVariance (firstTop, left, firstBottom, right, img, outerAvg) + absVariance (secondTop, left, secondBottom, right, img, outerAvg)) / 2.0; innerAvg = img.aaverage (firstBottom, left, secondTop, right); innerVariance = absVariance (firstBottom, left, secondTop, right, img, innerAvg); } outerSDev = sqrt (outerVariance); innerSDev = sqrt (innerVariance); } ColorImage* ImageResizer::resize(int rows, int cols, int steps) { if (rows <= 0 || cols <= 0) { throw invalid_argument ("rows or columns arg is <= zero"); } m_qRows = (float)rows / m_image.rows(); m_qCols = (float)cols / m_image.cols(); m_factor = m_qRows; /* no dimension change necessary? do the job and go away */ if (fabs (m_qRows - m_qCols) < COEFF_EPSILON) { return m_image.scale (m_factor, m_scalingStrategy); } calcDimensions (rows, cols); Image *maxDetail = prepareImage (rows, cols, steps); coeff outerAvg; coeff outerSDev; coeff innerAvg; coeff innerSDev; // maxDetail->rows () / maxDetali->cols () == ratio; double ratio = (double)rows / (double)cols; double mapping; int maxI = 0; if (m_cropWhat == CROP_COLS) { //std::cout << "cropping columns..." << std::endl; // ratio = maxDetail->rows () / (maxDetail->cols () - 2 * maxI) // ratio * (maxDetail->cols () - 2 * maxI) = maxDetail->rows () // maxDetail->cols () - 2 * maxI = maxDetail->rows () / ratio maxI = - (int)(maxDetail->rows () / ratio - maxDetail->cols () + 0.5); mapping = m_resized->cols () / maxDetail->cols (); assert (maxI <= maxDetail->cols ()); } else { //std::cout << "cropping rows..." << std::endl; // ratio = (maxDetail->rows () - 2 * maxI) / maxDetail->cols () // ratio * maxDetail->cols () = maxDetail->rows () - 2 * maxI maxI = - (int)(maxDetail->cols () * ratio - maxDetail->rows () + 0.5); mapping = m_resized->rows () / maxDetail->rows (); assert (maxI <= maxDetail->rows ()); } maxI /= 2; //std::cout << "maxI: " << maxI << ", ratio: " << ratio << std::endl; int nDiscardEach = 0; double outerByInner; cout.setf (ios::fixed, ios::floatfield); for (int i = 1; i < maxI && nDiscardEach == 0; i++) { calcStats(*maxDetail, i, outerAvg, outerSDev, innerAvg, innerSDev); outerByInner = outerAvg / innerAvg; cout.setf (ios::fixed, ios::floatfield); /*cout << "i: " << std::setw (2) << i << std::setw (2) << ", oa: " << outerAvg << std::setw (2) << ", os: " << outerSDev << std::setw (2) << ", ia: " << innerAvg << std::setw (2) << ", is: " << innerSDev << std::setw (2) << ", o / i: " << outerByInner << endl;*/ m_innerAvgPerSize = innerAvg / maxDetail->size (); m_innerSDeviation = innerSDev; if (outerByInner > m_threshold) { nDiscardEach = (i > 0)? (int)(mapping * (i - 1)) : 0; } } doResizeImage(rows, cols, nDiscardEach); DELETE (maxDetail); ColorImage *ret = m_resized; m_resized = NULL; return ret; } Index: configure.in =================================================================== RCS file: /cvsroot/wavelet/Wavelet/configure.in,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** configure.in 8 Dec 2004 11:53:01 -0000 1.2 --- configure.in 7 Aug 2007 17:00:59 -0000 1.3 *************** *** 97,100 **** --- 97,108 ---- AC_SUBST(JPEG_LIB) + CHECK_PFI="yes" + dnl Checks if we are going to enable the pfi library + AC_ARG_ENABLE(debug, + [--disable-pfi Turn off pfi support], + CHECK_PFI="no", + CHECK_PFI="yes" + ) + dnl Checks for pfi header. AC_CHECK_HEADER(pfi.h, *************** *** 107,110 **** --- 115,121 ---- ) + test "$CHECK_PFI" = "no" && PFI_DEF="" + test "$CHECK_PFI" = "no" && PFI_LIB="" + AC_SUBST(PFI_DEF) AC_SUBST(PFI_LIB) Index: Makefile.in =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Makefile.in,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Makefile.in 15 Aug 2005 17:09:41 -0000 1.10 --- Makefile.in 7 Aug 2007 17:00:58 -0000 1.11 *************** *** 49,53 **** OBJ9 = ImageInformation$O ImageComparison$O Histogram$O ImageDenoiser$O OBJA = VideoFrame$O ColorVideo$O VideoFile$O VideoReader$O VidReader$O ! OBJB = VideoWriter$O VidWriter$O AviReader$O AviWriter$O ifneq (@PFI_DEF@,) PFIO = PfgReader$O PfgWriter$O PfcReader$O PfcWriter$O --- 49,53 ---- OBJ9 = ImageInformation$O ImageComparison$O Histogram$O ImageDenoiser$O OBJA = VideoFrame$O ColorVideo$O VideoFile$O VideoReader$O VidReader$O ! OBJB = VideoWriter$O VidWriter$O AviReader$O AviWriter$O ImageResizer$O ifneq (@PFI_DEF@,) PFIO = PfgReader$O PfgWriter$O PfcReader$O PfcWriter$O *************** *** 140,150 **** tar: Wavelet-$(VERSION).tar.gz ! Wavelet-$(VERSION).tar.gz: *.cc *.hh *.h configure.in configure config.guess \ ! config.sub install-sh latex/*.* images/*.* Makefile.in test/*.cc ! test/*.vid test/Makefile.in test/*.raw test/*.pgm test/*.pfi \ ! test/*.ppm test/*.jpg W*/*.hh W*/*.h tools/*.cc tools/Makefile.in \ ! man/*.1 COPYING INSTALL INSTALL.W32 README Makefile.msc \ ! tools/Makefile.msc Makefile.mdd test/Makefile.msc Makefile.watcomc \ ! tools/Makefile.watcomc test/Makefile.watcomc ChangeLog Doxyfile.in $(MAKE) clean tar -C .. -czvpf $@ $(addprefix Wavelet/, $^) --- 140,151 ---- tar: Wavelet-$(VERSION).tar.gz ! Wavelet-$(VERSION).tar.gz: *.c *.cc *.hh *.h \ ! configure.in configure config.guess config.sub install-sh \ ! images/*.* test/*.cc test/*.h W*/*.hh W*/*.h tools/*.cc \ ! test/*.vid test/*.raw test/*.pgm test/*.pfi test/*.ppm test/*.jpg \ ! test/tw*.avi man/*.1 COPYING INSTALL INSTALL.W32 README ChangeLog \ ! Makefile.in Makefile.msc Makefile.watcomc Makefile.mdd Doxyfile.in \ ! tools/Makefile.in tools/Makefile.msc tools/Makefile.watcomc \ ! test/Makefile.in test/Makefile.msc test/Makefile.watcomc $(MAKE) clean tar -C .. -czvpf $@ $(addprefix Wavelet/, $^) *************** *** 276,280 **** %.dd: %.cc ! @$(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $< \ | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \ [ -s $@ ] || rm -f $@' --- 277,281 ---- %.dd: %.cc ! @$(SHELL) -ec '$(CXX) -MM $(CPPFLAGS) $< \ | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \ [ -s $@ ] || rm -f $@' Index: PgmReader.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PgmReader.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PgmReader.cc 8 Mar 2006 17:14:57 -0000 1.3 --- PgmReader.cc 7 Aug 2007 17:00:58 -0000 1.4 *************** *** 10,14 **** #include "WImage/PgmReader.hh" #include "WImage/debug.h" ! #include <stdio.h> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) --- 10,14 ---- #include "WImage/PgmReader.hh" #include "WImage/debug.h" ! #include <cstdio> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) Index: PpmReader.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PpmReader.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PpmReader.cc 8 Mar 2006 17:14:57 -0000 1.5 --- PpmReader.cc 7 Aug 2007 17:00:59 -0000 1.6 *************** *** 11,15 **** #include "WImage/debug.h" #include "ppmlib.h" ! #include <stdio.h> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) --- 11,15 ---- #include "WImage/debug.h" #include "ppmlib.h" ! #include <cstdio> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) Index: RawReader.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/RawReader.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RawReader.cc 8 Mar 2006 17:14:57 -0000 1.4 --- RawReader.cc 7 Aug 2007 17:00:59 -0000 1.5 *************** *** 10,14 **** #include "WImage/RawReader.hh" #include "WImage/debug.h" ! #include <stdio.h> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) --- 10,14 ---- #include "WImage/RawReader.hh" #include "WImage/debug.h" ! #include <cstdio> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) Index: ImageComparison.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ImageComparison.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ImageComparison.cc 8 Mar 2006 17:14:57 -0000 1.7 --- ImageComparison.cc 7 Aug 2007 17:00:58 -0000 1.8 *************** *** 13,18 **** #undef DELETE #endif ! #include <math.h> ! #include <assert.h> #include "WImage/miscdefs.h" --- 13,18 ---- #undef DELETE #endif ! #include <cmath> ! #include <cassert> #include "WImage/miscdefs.h" Index: tools.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** tools.cc 13 Jul 2005 12:13:23 -0000 1.6 --- tools.cc 7 Aug 2007 17:00:59 -0000 1.7 *************** *** 8,16 **** #include "WImage/tools.h" ! #include <float.h> ! #include <math.h> ! #include <ctype.h> ! #include <string.h> ! #include <stdio.h> #include <stdexcept> --- 8,16 ---- #include "WImage/tools.h" ! #include <cfloat> ! #include <cmath> ! #include <cctype> ! #include <cstring> ! #include <cstdio> #include <stdexcept> Index: PixmapWriter.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PixmapWriter.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PixmapWriter.cc 10 Aug 2005 09:35:23 -0000 1.2 --- PixmapWriter.cc 7 Aug 2007 17:00:58 -0000 1.3 *************** *** 12,21 **** #include "WImage/debug.h" #include "WImage/tools.h" ! #include <math.h> #include <iostream> #include <stdexcept> #include <fstream> ! #include <assert.h> ! #include <float.h> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) --- 12,21 ---- #include "WImage/debug.h" #include "WImage/tools.h" ! #include <cmath> #include <iostream> #include <stdexcept> #include <fstream> ! #include <cassert> ! #include <cfloat> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) Index: VidWriter.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/VidWriter.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VidWriter.cc 8 Mar 2006 17:14:57 -0000 1.3 --- VidWriter.cc 7 Aug 2007 17:00:59 -0000 1.4 *************** *** 10,14 **** #include "WImage/debug.h" #include "WImage/tools.h" ! #include <stdio.h> int --- 10,14 ---- #include "WImage/debug.h" #include "WImage/tools.h" ! #include <cstdio> int Index: StillImage.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/StillImage.cc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** StillImage.cc 22 May 2007 14:55:44 -0000 1.11 --- StillImage.cc 7 Aug 2007 17:00:59 -0000 1.12 *************** *** 22,27 **** #endif #include <stdexcept> ! #include <string.h> ! #include <assert.h> #ifndef _WIN32_WCE #include <iostream> --- 22,27 ---- #endif #include <stdexcept> ! #include <cstring> ! #include <cassert> #ifndef _WIN32_WCE #include <iostream> *************** *** 37,41 **** StillImage::mkImage (int rows, int cols) const { ! return NEW (StillImage (rows, cols)); } --- 37,44 ---- StillImage::mkImage (int rows, int cols) const { ! //return NEW (StillImage (rows, cols)); ! Image *ret = NEW (StillImage (rows, cols)); ! //std::cout << "mkImage: " << ret << std::endl; ! return ret; } Index: Filter.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Filter.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Filter.cc 10 Aug 2005 09:35:23 -0000 1.3 --- Filter.cc 7 Aug 2007 17:00:58 -0000 1.4 *************** *** 25,34 **** /*---------------------------------------------------------------------------*/ #include <stdexcept> ! #include <stdio.h> ! #include <stdarg.h> ! #include <stdlib.h> ! #include <string.h> ! #include <math.h> ! #include <assert.h> #include "Wave/Filter.hh" --- 25,34 ---- /*---------------------------------------------------------------------------*/ #include <stdexcept> ! #include <cstdio> ! #include <cstdarg> ! #include <cstdlib> ! #include <cstring> ! #include <cmath> ! #include <cassert> #include "Wave/Filter.hh" Index: ImageDenoiser.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ImageDenoiser.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ImageDenoiser.cc 8 Mar 2006 17:14:57 -0000 1.7 --- ImageDenoiser.cc 7 Aug 2007 17:00:58 -0000 1.8 *************** *** 12,18 **** #undef DELETE #endif ! #include <assert.h> #include <stdexcept> ! #include <math.h> #include "WImage/miscdefs.h" --- 12,18 ---- #undef DELETE #endif ! #include <cassert> #include <stdexcept> ! #include <cmath> #include "WImage/miscdefs.h" Index: Makefile.mdd =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Makefile.mdd,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.mdd 14 Jan 2005 13:51:15 -0000 1.5 --- Makefile.mdd 7 Aug 2007 17:00:58 -0000 1.6 *************** *** 1 **** ! # # MSC Makefile for Wave -- (c) 2002 by Herbert # # This Makefile is used for creating object files with the -MDd switch # to avoid library conflicts when using it in MFC apps. # # No dependency checking done! # SHELL = cmd.exe /c # # The program's main version... # VERSION = 0.9a MAJOR = 0 # # tools used for compiling / installing... # CXX = cl -nologo AR = lib O = .obj E = .exe A = .lib # # Name of target object files: # OBJ1 = debug$O tools$O avilib$O OBJ2 = ImageVector$O RowVector$O ColumnVector$O FullVector$O OBJ3 = GreymapFile$O GreymapReader$O GreymapWriter$O PgmReader$O PgmWriter$O OBJ4 = RawReader$O RawWriter$O FileName$O Image$O StillImage$O ppmlib$O OBJ5 = ColorImage$O PixmapFile$O PixmapReader$O PixmapWriter$O PpmReader$O OBJ6 = PpmWriter$O CoeffInformation$O PyramidTree$O ColorBuffer$O OBJ7 = Wavelet$O WaveletTransform$O PyramidTransform$O StandardTransform$O OBJ8 = Filter$O VectorPosition$O MirrorPosition$O PeriodicPosition$O OBJ9 = ImageInformation$O ImageComparison$O Histogram$O ImageDenoiser$O OBJA = VideoFrame$O ColorVideo$O VideoFile$O VideoReader$O VidReader$O OBJB = VideoWriter$O VidWriter$O AviReader$O AviWriter$O JPEG0 = JpgReader$O JpgWriter$O LIBS = .PHONY: all clean _test _tools tar zip # # Main target and file dependencies: # all: wavelet$A # # Flags passed to the compiler # CPPFLAGS = -I. -I../vc6/include -DJPEG -I../jpeg-6b CXXDEBUG = -DDPRINTF="" CXXOPT = -Ox CFLAGS = $(CXXDEBUG) $(CPPFLAGS) $(CXXOPT) -W3 -WX CXXFLAGS = $(CFLAGS) -TP -GX -GR -MDd # # Flags passed to the lib utility # ARFLAGS = /nologo /out: # # Automatic stuff, should not be changed: # OBJS = $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(OBJ6) $(OBJ7) $(OBJ8) \ $(OBJ9) $(OBJA) $(OBJB) $(JPEGO) # # rules: # zip: Wavelet-$(VERSION)-win32-bin.zip Wavelet-$(VERSION)-win32-bin.zip: $(MAKE) all _test -f Makefile.msc cd .. & zip $@ Wavelet/*.h Wavelet/*.hh Wavelet/COPYING \ Wavelet/INSTALL Wavelet/README Wavelet/INSTALL.W32 Wavelet/ChangeLog \ Wavelet/ImageArray.cc Wavelet/VideoArray.cc Wavelet/NTree.cc \ Wavelet/W*/*.h Wavelet/W*/*.hh Wavelet/wavelet$A Wavelet/tools/*$E Wavelet/man/*.1 Wavelet/images/*.* Wavelet/test/*$E \ Wavelet/test/*.ppm Wavelet/test/*.pgm Wavelet/test/*.raw \ Wavelet/test/*.pfi move ..\\$@ . tar: Wavelet-$(VERSION)-win32-bin.tar.gz Wavelet-$(VERSION)-win32-bin.tar.gz: $(MAKE) all _test -f Makefile.msc cd .. & tar -czvpf $@ Wavelet/*.h Wavelet/*.hh Wavelet/COPYING \ Wavelet/INSTALL Wavelet/README Wavelet/INSTALL.W32 Wavelet/ChangeLog \ Wavelet/ImageArray.cc Wavelet/VideoArray.cc Wavelet/NTree.cc \ Wavelet/W*/*.h Wavelet/W*/*.hh Wavelet/wavelet$A Wavelet/tools/*$E Wavelet/man/*.1 Wavelet/images/*.* Wavelet/test/*$E Wavelet/test/*.ppm \ Wavelet/test/*.pgm Wavelet/test/*.raw Wavelet/test/*.pfi move ../$@ . wavelet$A: $(OBJS) $(AR) $(ARFLAGS)$@ $(OBJS) clean: -del $(OBJS) Wave\\*~ *~ wavelet$A Wavelet-$(VERSION)-win32-bin.tar.gz -cd test & $(MAKE) -nologo -f Makefile.msc clean -cd tools & $(MAKE) -nologo -f Makefile.msc clean # # Automatic targets and rules: # .SUFFIXES: $O .cc .cc$O: $(CXX) -c $(CXXFLAGS) $< .c$O: $(CXX) -c $(CFLAGS) $< \ No newline at end of file --- 1 ---- ! # # MSC Makefile for Wave -- (c) 2002 by Herbert # # This Makefile is used for creating object files with the -MDd switch # to avoid library conflicts when using it in MFC apps. # # No dependency checking done! # SHELL = cmd.exe /c # # The program's main version... # VERSION = 0.9a MAJOR = 0 # # tools used for compiling / installing... # CXX = cl -nologo AR = lib O = .obj E = .exe A = .lib # # Name of target object files: # OBJ1 = debug$O tools$O avilib$O OBJ2 = ImageVector$O RowVector$O ColumnVector$O FullVector$O OBJ3 = GreymapFile$O GreymapReader$O GreymapWriter$O PgmReader$O PgmWriter$O OBJ4 = RawReader$O RawWriter$O FileName$O Image$O StillImage$O ppmlib$O OBJ5 = ColorImage$O PixmapFile$O PixmapReader$O PixmapWriter$O PpmReader$O OBJ6 = PpmWriter$O CoeffInformation$O PyramidTree$O ColorBuffer$O OBJ7 = Wavelet$O WaveletTransform$O PyramidTransform$O StandardTransform$O OBJ8 = Filter$O VectorPosition$O MirrorPosition$O PeriodicPosition$O OBJ9 = ImageInformation$O ImageComparison$O Histogram$O ImageDenoiser$O OBJA = VideoFrame$O ColorVideo$O VideoFile$O VideoReader$O VidReader$O OBJB = VideoWriter$O VidWriter$O AviReader$O AviWriter$O ImageResizer$O JPEG0 = JpgReader$O JpgWriter$O LIBS = .PHONY: all clean _test _tools tar zip # # Main target and file dependencies: # all: wavelet$A # # Flags passed to the compiler # CPPFLAGS = -I. -I../vc6/include -DJPEG -I../jpeg-6b CXXDEBUG = -DDPRINTF="" CXXOPT = -Ox CFLAGS = $(CXXDEBUG) $(CPPFLAGS) $(CXXOPT) -W3 -WX CXXFLAGS = $(CFLAGS) -TP -GX -GR -MDd # # Flags passed to the lib utility # ARFLAGS = /nologo /out: # # Automatic stuff, should not be changed: # OBJS = $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(OBJ6) $(OBJ7) $(OBJ8) \ $(OBJ9) $(OBJA) $(OBJB) $(JPEGO) # # rules: # zip: Wavelet-$(VERSION)-win32-bin.zip Wavelet-$(VERSION)-win32-bin.zip: $(MAKE) all _test -f Makefile.msc cd .. & zip $@ Wavelet/*.h Wavelet/*.hh Wavelet/COPYING \ Wavelet/INSTALL Wavelet/README Wavelet/INSTALL.W32 Wavelet/ChangeLog \ Wavelet/ImageArray.cc Wavelet/VideoArray.cc Wavelet/NTree.cc \ Wavelet/W*/*.h Wavelet/W*/*.hh Wavelet/wavelet$A Wavelet/tools/*$E Wavelet/man/*.1 Wavelet/images/*.* Wavelet/test/*$E \ Wavelet/test/*.ppm Wavelet/test/*.pgm Wavelet/test/*.raw \ Wavelet/test/*.pfi move ..\\$@ . tar: Wavelet-$(VERSION)-win32-bin.tar.gz Wavelet-$(VERSION)-win32-bin.tar.gz: $(MAKE) all _test -f Makefile.msc cd .. & tar -czvpf $@ Wavelet/*.h Wavelet/*.hh Wavelet/COPYING \ Wavelet/INSTALL Wavelet/README Wavelet/INSTALL.W32 Wavelet/ChangeLog \ Wavelet/ImageArray.cc Wavelet/VideoArray.cc Wavelet/NTree.cc \ Wavelet/W*/*.h Wavelet/W*/*.hh Wavelet/wavelet$A Wavelet/tools/*$E Wavelet/man/*.1 Wavelet/images/*.* Wavelet/test/*$E Wavelet/test/*.ppm \ Wavelet/test/*.pgm Wavelet/test/*.raw Wavelet/test/*.pfi move ../$@ . wavelet$A: $(OBJS) $(AR) $(ARFLAGS)$@ $(OBJS) clean: -del $(OBJS) Wave\\*~ *~ wavelet$A Wavelet-$(VERSION)-win32-bin.tar.gz -cd test & $(MAKE) -nologo -f Makefile.msc clean -cd tools & $(MAKE) -nologo -f Makefile.msc clean # # Automatic targets and rules: # .SUFFIXES: $O .cc .cc$O: $(CXX) -c $(CXXFLAGS) $< .c$O: $(CXX) -c $(CFLAGS) $< \ No newline at end of file Index: Wavelet.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Wavelet.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Wavelet.cc 10 Aug 2005 09:35:23 -0000 1.4 --- Wavelet.cc 7 Aug 2007 17:00:59 -0000 1.5 *************** *** 9,13 **** //#undef DPRINTF ! #include <stdio.h> #ifndef _WIN32_WCE #include <iostream> --- 9,13 ---- //#undef DPRINTF ! #include <cstdio> #ifndef _WIN32_WCE #include <iostream> *************** *** 15,20 **** #endif #include <stdexcept> ! #include <assert.h> ! #include <math.h> #include "Wave/Wavelet.hh" #include "Wave/MirrorPosition.hh" --- 15,20 ---- #endif #include <stdexcept> ! #include <cassert> ! #include <cmath> #include "Wave/Wavelet.hh" #include "Wave/MirrorPosition.hh" Index: JpgWriter.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/JpgWriter.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** JpgWriter.cc 8 Mar 2006 17:14:57 -0000 1.3 --- JpgWriter.cc 7 Aug 2007 17:00:58 -0000 1.4 *************** *** 10,14 **** #include "WImage/debug.h" #include "WImage/tools.h" ! #include <stdio.h> extern "C" { #include <jpeglib.h> --- 10,14 ---- #include "WImage/debug.h" #include "WImage/tools.h" ! #include <cstdio> extern "C" { #include <jpeglib.h> Index: NTree.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/NTree.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NTree.cc 22 Mar 2005 17:28:20 -0000 1.4 --- NTree.cc 7 Aug 2007 17:00:58 -0000 1.5 *************** *** 11,15 **** #include "WTools/NTree.hh" ! #include <assert.h> #ifdef _WIN32_WCE #include "WImage/miscdefs.h" --- 11,15 ---- #include "WTools/NTree.hh" ! #include <cassert> #ifdef _WIN32_WCE #include "WImage/miscdefs.h" Index: PgmWriter.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PgmWriter.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PgmWriter.cc 8 Mar 2006 17:14:57 -0000 1.2 --- PgmWriter.cc 7 Aug 2007 17:00:58 -0000 1.3 *************** *** 9,13 **** #include "WImage/PgmWriter.hh" #include "WImage/debug.h" ! #include <stdio.h> int --- 9,13 ---- #include "WImage/PgmWriter.hh" #include "WImage/debug.h" ! #include <cstdio> int Index: AviWriter.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/AviWriter.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AviWriter.cc 8 Mar 2006 17:14:57 -0000 1.7 --- AviWriter.cc 7 Aug 2007 17:00:58 -0000 1.8 *************** *** 10,14 **** #include "WImage/debug.h" #include "WImage/tools.h" ! #include <stdio.h> #include <iostream> --- 10,14 ---- #include "WImage/debug.h" #include "WImage/tools.h" ! #include <cstdio> #include <iostream> Index: ColorVideo.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ColorVideo.cc,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ColorVideo.cc 8 Mar 2006 17:14:57 -0000 1.15 --- ColorVideo.cc 7 Aug 2007 17:00:58 -0000 1.16 *************** *** 22,26 **** #include <iostream> #endif ! #include <assert.h> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) --- 22,26 ---- #include <iostream> #endif ! #include <cassert> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) Index: VidReader.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/VidReader.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** VidReader.cc 8 Mar 2006 17:14:57 -0000 1.7 --- VidReader.cc 7 Aug 2007 17:00:59 -0000 1.8 *************** *** 11,15 **** #include "WImage/debug.h" #include "WImage/tools.h" ! #include <stdio.h> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) --- 11,15 ---- #include "WImage/debug.h" #include "WImage/tools.h" ! #include <cstdio> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) Index: Image.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Image.cc,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Image.cc 15 Aug 2005 10:18:08 -0000 1.23 --- Image.cc 7 Aug 2007 17:00:58 -0000 1.24 *************** *** 13,19 **** #undef DELETE #endif ! #include <assert.h> ! #include <math.h> ! #include <stdlib.h> #include <stdexcept> #ifndef _WIN32_WCE --- 13,19 ---- #undef DELETE #endif [...1129 lines suppressed...] assert (alpha <= 1); --- 1232,1236 ---- // .. coeff alpha; ! alpha = (px - (int)px); assert (alpha <= 1); *************** *** 1177,1181 **** v1 = img.at (iy, (int)px); v2 = img.at (iy, px1); ! return (v2 - v1) * alpha + v1; } --- 1240,1244 ---- v1 = img.at (iy, (int)px); v2 = img.at (iy, px1); ! return (v2 - v1) * alpha + v1; } Index: Makefile.watcomc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Makefile.watcomc,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile.watcomc 25 Mar 2005 09:55:48 -0000 1.7 --- Makefile.watcomc 7 Aug 2007 17:00:58 -0000 1.8 *************** *** 15,19 **** PyramidTree$O ImageDenoiser$O VideoFrame$O ColorVideo$O & VideoFile$O VideoReader$O VidReader$O VideoWriter$O VidWriter$O & ! AviReader$O AviWriter$O TARGET = wavelet$A --- 15,19 ---- PyramidTree$O ImageDenoiser$O VideoFrame$O ColorVideo$O & VideoFile$O VideoReader$O VidReader$O VideoWriter$O VidWriter$O & ! AviReader$O AviWriter$O ImageResizer$O TARGET = wavelet$A *************** *** 67,77 **** ARCHIVE = Wavelet/*.h Wavelet/*.hh Wavelet/COPYING Wavelet/INSTALL & ! Wavelet/README Wavelet/INSTALL.W32 Wavelet/ChangeLog & Wavelet/ImageArray.cc Wavelet/VideoArray.cc Wavelet/NTree.cc & ! Wavelet/WImage/*.h Wavelet/Wave/*.hh Wavelet/WImage/*.hh & ! Wavelet/WTools/*.hh Wavelet/wavelet$A Wavelet/tools/*$E & ! Wavelet/man/*.1 Wavelet/images/*.* Wavelet/test/*$E & ! Wavelet/test/*.ppm Wavelet/test/*.pgm Wavelet/test/*.raw & ! Wavelet/test/*.pfi Wavelet-$(VERSION)-watcom-bin.zip: --- 67,77 ---- ARCHIVE = Wavelet/*.h Wavelet/*.hh Wavelet/COPYING Wavelet/INSTALL & ! Wavelet/README Wavelet/INSTALL.W32 Wavelet/ChangeLog & Wavelet/ImageArray.cc Wavelet/VideoArray.cc Wavelet/NTree.cc & ! Wavelet/WImage/*.h Wavelet/Wave/*.hh Wavelet/WImage/*.hh & ! Wavelet/WTools/*.hh Wavelet/wavelet$A Wavelet/tools/*$E & ! Wavelet/man/*.1 Wavelet/images/*.* Wavelet/test/*$E & ! Wavelet/test/*.ppm Wavelet/test/*.pgm Wavelet/test/*.raw & ! Wavelet/test/*.pfi Wavelet-$(VERSION)-watcom-bin.zip: Index: CoeffInformation.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/CoeffInformation.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CoeffInformation.cc 10 Aug 2005 09:35:23 -0000 1.4 --- CoeffInformation.cc 7 Aug 2007 17:00:58 -0000 1.5 *************** *** 8,12 **** #include "WImage/CoeffInformation.hh" ! #include <math.h> #ifndef _WIN32_WCE #include <fstream> --- 8,12 ---- #include "WImage/CoeffInformation.hh" ! #include <cmath> #ifndef _WIN32_WCE #include <fstream> Index: PfcWriter.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PfcWriter.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PfcWriter.cc 10 Aug 2005 09:35:23 -0000 1.4 --- PfcWriter.cc 7 Aug 2007 17:00:58 -0000 1.5 *************** *** 9,13 **** #include "WImage/PfcWriter.hh" #include "WImage/debug.h" ! #include <stdio.h> #include <pfi.h> --- 9,13 ---- #include "WImage/PfcWriter.hh" #include "WImage/debug.h" ! #include <cstdio> #include <pfi.h> Index: PyramidTree.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PyramidTree.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PyramidTree.cc 18 Feb 2005 12:12:24 -0000 1.4 --- PyramidTree.cc 7 Aug 2007 17:00:59 -0000 1.5 *************** *** 8,12 **** #include "WTools/PyramidTree.hh" ! #include <assert.h> PyramidTree::PyramidTree (PyramidTransform &t, int y, int x, int position, --- 8,12 ---- #include "WTools/PyramidTree.hh" ! #include <cassert> PyramidTree::PyramidTree (PyramidTransform &t, int y, int x, int position, Index: ppmlib.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ppmlib.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ppmlib.cc 8 Mar 2006 17:14:57 -0000 1.4 --- ppmlib.cc 7 Aug 2007 17:00:59 -0000 1.5 *************** *** 9,14 **** #include "ppmlib.h" #include "WImage/miscdefs.h" ! #include <ctype.h> ! #include <assert.h> static int --- 9,14 ---- #include "ppmlib.h" #include "WImage/miscdefs.h" ! #include <cctype> ! #include <cassert> static int Index: GreymapWriter.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/GreymapWriter.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GreymapWriter.cc 22 May 2007 14:55:44 -0000 1.3 --- GreymapWriter.cc 7 Aug 2007 17:00:58 -0000 1.4 *************** *** 12,21 **** #include "WImage/debug.h" #include "WImage/tools.h" ! #include <math.h> #include <iostream> #include <stdexcept> #include <fstream> ! #include <assert.h> ! #include <float.h> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) --- 12,21 ---- #include "WImage/debug.h" #include "WImage/tools.h" ! #include <cmath> #include <iostream> #include <stdexcept> #include <fstream> ! #include <cassert> ! #include <cfloat> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) Index: configure =================================================================== RCS file: /cvsroot/wavelet/Wavelet/configure,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** configure 8 Dec 2004 11:53:01 -0000 1.2 --- configure 7 Aug 2007 17:00:59 -0000 1.3 *************** *** 1,7 **** #! /bin/sh # Guess values for system-dependent variables and create Makefiles. ! # Generated by GNU Autoconf 2.59. # ! # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. --- 1,8 ---- #! /bin/sh # Guess values for system-dependent variables and create Makefiles. [...8267 lines suppressed...] ! { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' ! which seems to be undefined. Please make sure it is defined." >&5 ! echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' ! which seems to be undefined. Please make sure it is defined." >&2;} ! ! rm -f "$tmp/stdin" ! case $ac_file in ! -) cat "$tmp/out"; rm -f "$tmp/out";; ! *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; ! esac ! ;; ! ! ! ! esac ! ! done # for ac_tag { (exit 0); exit 0; } Index: JpgReader.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/JpgReader.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JpgReader.cc 8 Mar 2006 17:14:57 -0000 1.4 --- JpgReader.cc 7 Aug 2007 17:00:58 -0000 1.5 *************** *** 10,19 **** #include "WImage/JpgReader.hh" #include "WImage/debug.h" ! #include <stdio.h> extern "C" { #include <jpeglib.h> } #include <setjmp.h> ! #include <assert.h> #include <stdexcept> #include <iostream> --- 10,19 ---- #include "WImage/JpgReader.hh" #include "WImage/debug.h" ! #include <cstdio> extern "C" { #include <jpeglib.h> } #include <setjmp.h> ! #include <cassert> #include <stdexcept> #include <iostream> *************** *** 23,35 **** #endif ! static pixel *readJpegFile (FILE *inFile, int &ysize, int &xsize, int &channels); ! int JpgReader::readfmt (void) { FILE *inFile = NULL; ! ! int xsize = 0; int ysize = 0; int xysize = 0; --- 23,35 ---- #endif ! static pixel *readJpegFile (FILE *inFile, int &ysize, int &xsize, int &channels); ! int JpgReader::readfmt (void) { FILE *inFile = NULL; ! ! int xsize = 0; int ysize = 0; int xysize = 0; *************** *** 40,44 **** inFile = stdin; } ! else { /* --- 40,44 ---- inFile = stdin; } ! else { /* *************** *** 47,54 **** inFile = fopen (m_fname, "rb"); } ! /* initialization */ pixel * allpixels = readJpegFile (inFile, ysize, xsize, channels); ! if (channels != 3 && channels != 1) { --- 47,54 ---- inFile = fopen (m_fname, "rb"); } ! /* initialization */ pixel * allpixels = readJpegFile (inFile, ysize, xsize, channels); ! if (channels != 3 && channels != 1) { *************** *** 71,75 **** "than initially expected."); } ! fclose (inFile); if (allpixels == NULL) --- 71,75 ---- "than initially expected."); } ! fclose (inFile); if (allpixels == NULL) *************** *** 78,82 **** } xysize = xsize * ysize; ! for (int i = 0; i < m_channels; i++) { --- 78,82 ---- } xysize = xsize * ysize; ! for (int i = 0; i < m_channels; i++) { *************** *** 86,90 **** } } ! /* import */ for (int i = 0; i < xysize; i++) --- 86,90 ---- } } ! /* import */ for (int i = 0; i < xysize; i++) *************** *** 98,102 **** /* cleanup */ DELETEAR (allpixels); ! return 0; } --- 98,102 ---- /* cleanup */ DELETEAR (allpixels); ! return 0; } *************** *** 104,108 **** /* * The following code is derived from the example.c file shipping with ! * the JPEG-lib distribution. */ --- 104,108 ---- /* * The following code is derived from the example.c file shipping with ! * the JPEG-lib distribution. */ *************** *** 147,161 **** static pixel * ! readJpegFile (FILE *inFile, int &ysize, int &xsize, int &channels) { assert (inFile != NULL); ! ! /* * This struct contains the JPEG decompression parameters and pointers to * working space (which is allocated as needed by the JPEG library). */ struct jpeg_decompress_struct cinfo; ! /* * We use our private extension JPEG error handler. * Note that this struct must live as long as the main JPEG parameter --- 147,161 ---- static pixel * ! readJpegFile (FILE *inFile, int &ysize, int &xsize, int &channels) { assert (inFile != NULL); ! ! /* * This struct contains the JPEG decompression parameters and pointers to * working space (which is allocated as needed by the JPEG library). */ struct jpeg_decompress_struct cinfo; ! /* * We use our private extension JPEG error handler. * Note that this struct must live as long as the main JPEG parameter *************** *** 176,183 **** ret = NULL; /* Establish the setjmp return context for jpgErrorHandler to use. */ ! if (setjmp (jerr.setjmpBuffer)) { /* If we get here, the JPEG code has signaled an error. ! * We need to clean up the JPEG object, close the input file, and * return. */ jpeg_destroy_decompress (&cinfo); --- 176,183 ---- ret = NULL; /* Establish the setjmp return context for jpgErrorHandler to use. */ ! if (setjmp (jerr.setjmpBuffer)) { /* If we get here, the JPEG code has signaled an error. ! * We need to clean up the JPEG object, close the input file, and * return. */ jpeg_destroy_decompress (&cinfo); *************** *** 195,210 **** jpeg_stdio_src (&cinfo, inFile); ! /* ! * Step 3: read file parameters with jpeg_read_header() * * We can ignore the return value from jpeg_read_header since * (a) suspension is not possible with the stdio data source, and * (b) we passed TRUE to reject a tables-only JPEG file as an error. ! * See libjpeg.doc for more info. */ (void)jpeg_read_header (&cinfo, TRUE); ! /* ! * Step 4: set parameters for decompression * * In this example, we don't need to change any of the defaults set by --- 195,210 ---- jpeg_stdio_src (&cinfo, inFile); ! /* ! * Step 3: read file parameters with jpeg_read_header() * * We can ignore the return value from jpeg_read_header since * (a) suspension is not possible with the stdio data source, and * (b) we passed TRUE to reject a tables-only JPEG file as an error. ! * See libjpeg.doc for more info. */ (void)jpeg_read_header (&cinfo, TRUE); ! /* ! * Step 4: set parameters for decompression * * In this example, we don't need to change any of the defaults set by *************** *** 224,233 **** // << channels << ", size: " << xsize * ysize * channels << endl; ret = NEW (pixel [xsize * ysize * channels]); ! /* We may need to do some setup of our own at this point before reading * the data. After jpeg_start_decompress() we have the correct scaled * output image dimensions available, as well as the output colormap * if we asked for color quantization. ! * In this case, we need to make an output work buffer of the right size. */ /* JSAMPLEs per row in output buffer */ --- 224,233 ---- // << channels << ", size: " << xsize * ysize * channels << endl; ret = NEW (pixel [xsize * ysize * channels]); ! /* We may need to do some setup of our own at this point before reading * the data. After jpeg_start_decompress() we have the correct scaled * output image dimensions available, as well as the output colormap * if we asked for color quantization. ! * In this case, we need to make an output work buffer of the right size. */ /* JSAMPLEs per row in output buffer */ *************** *** 238,249 **** ((j_common_ptr) &cinfo, JPOOL_IMAGE, rowStride, 1); ! /* ! * Step 6: while (scan lines remain to be read) ! * jpeg_read_scanlines(...); */ /* Here we use the library's state variable cinfo.output_scanline as the * loop counter, so that we don't have to keep track ourselves. */ ! while (cinfo.output_scanline < cinfo.output_height) { /* jpeg_read_scanlines expects an array of pointers to scanlines. --- 238,249 ---- ((j_common_ptr) &cinfo, JPOOL_IMAGE, rowStride, 1); ! /* ! * Step 6: while (scan lines remain to be read) ! * jpeg_read_scanlines(...); */ /* Here we use the library's state variable cinfo.output_scanline as the * loop counter, so that we don't have to keep track ourselves. */ ! while (cinfo.output_scanline < cinfo.output_height) { /* jpeg_read_scanlines expects an array of pointers to scanlines. *************** *** 254,258 **** //cout << cinfo.output_scanline - 1 << " * " << rowStride << endl; /* Assume put_scanline_someplace wants a pointer and sample count. */ ! memcpy(&(ret[(cinfo.output_scanline - 1) * rowStride]), buffer[0], rowStride); //cout << "done" << endl; --- 254,258 ---- //cout << cinfo.output_scanline - 1 << " * " << rowStride << endl; /* Assume put_scanline_someplace wants a pointer and sample count. */ ! memcpy(&(ret[(cinfo.output_scanline - 1) * rowStride]), buffer[0], rowStride); //cout << "done" << endl; *************** *** 262,266 **** (void)jpeg_finish_decompress (&cinfo); ! /* * We can ignore the return value since suspension is not possible * with the stdio data source. --- 262,266 ---- (void)jpeg_finish_decompress (&cinfo); ! /* * We can ignore the return value since suspension is not possible * with the stdio data source. *************** *** 272,276 **** jpeg_destroy_decompress (&cinfo); ! /* * At this point you may want to check to see whether any corrupt-data * warnings occurred (test whether jerr.pub.num_warnings is nonzero). --- 272,276 ---- jpeg_destroy_decompress (&cinfo); ! /* * At this point you may want to check to see whether any corrupt-data * warnings occurred (test whether jerr.pub.num_warnings is nonzero). Index: Histogram.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Histogram.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Histogram.cc 10 Aug 2005 09:35:23 -0000 1.5 --- Histogram.cc 7 Aug 2007 17:00:58 -0000 1.6 *************** *** 12,17 **** #endif #include <stdexcept> ! #include <math.h> ! #include <assert.h> #ifndef _WIN32_WCE #include <iostream> --- 12,17 ---- #endif #include <stdexcept> ! #include <cmath> ! #include <cassert> #ifndef _WIN32_WCE #include <iostream> Index: VideoArray.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/VideoArray.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** VideoArray.cc 8 Apr 2005 08:17:46 -0000 1.5 --- VideoArray.cc 7 Aug 2007 17:00:59 -0000 1.6 *************** *** 18,22 **** #endif #include <stdexcept> ! #include <assert.h> #include "WImage/miscdefs.h" --- 18,22 ---- #endif #include <stdexcept> ! #include <cassert> #include "WImage/miscdefs.h" Index: wave_version.h =================================================================== RCS file: /cvsroot/wavelet/Wavelet/wave_version.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wave_version.h 15 Aug 2005 16:33:47 -0000 1.4 --- wave_version.h 7 Aug 2007 17:00:59 -0000 1.5 *************** *** 12,16 **** #define __VERSION_H ! #define WAVE_VERSION "1.1" #endif --- 12,16 ---- #define __VERSION_H ! #define WAVE_VERSION "1.2-cvs" #endif Index: PfcReader.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PfcReader.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PfcReader.cc 8 Mar 2006 17:14:57 -0000 1.6 --- PfcReader.cc 7 Aug 2007 17:00:58 -0000 1.7 *************** *** 11,15 **** #include "WImage/debug.h" #include <pfi.h> ! #include <stdio.h> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) --- 11,15 ---- #include "WImage/debug.h" #include <pfi.h> ! #include <cstdio> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) Index: AviReader.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/AviReader.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AviReader.cc 10 Aug 2005 09:35:23 -0000 1.5 --- AviReader.cc 7 Aug 2007 17:00:58 -0000 1.6 *************** *** 10,14 **** #include "WImage/AviReader.hh" #include "WImage/debug.h" ! #include <stdio.h> extern "C" { --- 10,14 ---- #include "WImage/AviReader.hh" #include "WImage/debug.h" ! #include <cstdio> extern "C" { Index: PixmapFile.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PixmapFile.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PixmapFile.cc 10 Aug 2005 09:35:23 -0000 1.3 --- PixmapFile.cc 7 Aug 2007 17:00:58 -0000 1.4 *************** *** 26,30 **** PixmapFile::~PixmapFile (void) { ! DELETE (m_images); } --- 26,30 ---- PixmapFile::~PixmapFile (void) { ! DELETEAR (m_images); } *************** *** 35,39 **** { m_images = NEW (Image* [m_channels]); ! for (int i = 0; i < m_channels; i++) { --- 35,39 ---- { m_images = NEW (Image* [m_channels]); ! for (int i = 0; i < m_channels; i++) { Index: debug.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/debug.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** debug.cc 18 Oct 2004 11:20:19 -0000 1.1 --- debug.cc 7 Aug 2007 17:00:59 -0000 1.2 *************** *** 9,14 **** //#if !defined (NDEBUG) && !defined (DPRINTF) #include "WImage/debug.h" ! #include <stdio.h> ! #include <stdarg.h> --- 9,14 ---- //#if !defined (NDEBUG) && !defined (DPRINTF) #include "WImage/debug.h" ! #include <cstdio> ! #include <cstdarg> Index: PfgWriter.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PfgWriter.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PfgWriter.cc 10 Aug 2005 09:35:23 -0000 1.4 --- PfgWriter.cc 7 Aug 2007 17:00:58 -0000 1.5 *************** *** 9,13 **** #include "WImage/PfgWriter.hh" #include "WImage/debug.h" ! #include <stdio.h> #include <pfi.h> --- 9,13 ---- #include "WImage/PfgWriter.hh" #include "WImage/debug.h" ! #include <cstdio> #include <pfi.h> Index: ImageArray.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ImageArray.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ImageArray.cc 22 Mar 2005 17:28:20 -0000 1.6 --- ImageArray.cc 7 Aug 2007 17:00:58 -0000 1.7 *************** *** 53,57 **** { DELETENOTNULLAR (m_ar); ! DELETENOTNULL (m_rows); } --- 53,57 ---- { DELETENOTNULLAR (m_ar); ! DELETENOTNULLAR (m_rows); } Index: Makefile.msc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Makefile.msc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Makefile.msc 30 Nov 2004 16:39:05 -0000 1.8 --- Makefile.msc 7 Aug 2007 17:00:58 -0000 1.9 *************** *** 35,39 **** OBJ9 = ImageInformation$O ImageComparison$O Histogram$O ImageDenoiser$O OBJA = VideoFrame$O ColorVideo$O VideoFile$O VideoReader$O VidReader$O ! OBJB = VideoWriter$O VidWriter$O AviReader$O AviWriter$O JPEG0 = JpgReader$O JpgWriter$O !ifdef PFIDEF --- 35,39 ---- OBJ9 = ImageInformation$O ImageComparison$O Histogram$O ImageDenoiser$O OBJA = VideoFrame$O ColorVideo$O VideoFile$O VideoReader$O VidReader$O ! OBJB = VideoWriter$O VidWriter$O AviReader$O AviWriter$O ImageResizer$O JPEG0 = JpgReader$O JpgWriter$O !ifdef PFIDEF Index: PpmWriter.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/PpmWriter.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PpmWriter.cc 8 Mar 2006 17:14:57 -0000 1.4 --- PpmWriter.cc 7 Aug 2007 17:00:59 -0000 1.5 *************** *** 11,15 **** #include "WImage/tools.h" #include "ppmlib.h" ! #include <stdio.h> int --- 11,15 ---- #include "WImage/tools.h" #include "ppmlib.h" ! #include <cstdio> int Index: VideoFrame.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/VideoFrame.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** VideoFrame.cc 10 Aug 2005 09:35:23 -0000 1.4 --- VideoFrame.cc 7 Aug 2007 17:00:59 -0000 1.5 *************** *** 26,31 **** #include <iostream> #endif ! #include <string.h> ! #include <assert.h> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) --- 26,31 ---- #include <iostream> #endif ! #include <cstring> ! #include <cassert> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) Index: ColorBuffer.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ColorBuffer.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ColorBuffer.cc 8 Mar 2006 17:14:57 -0000 1.8 --- ColorBuffer.cc 7 Aug 2007 17:00:58 -0000 1.9 *************** *** 15,22 **** #endif #include <stdexcept> ! #include <assert.h> #ifndef _WIN32_WCE #include <iostream> ! #include <stdio.h> #else #include "WImage/miscdefs.h" --- 15,22 ---- #endif #include <stdexcept> ! #include <cassert> #ifndef _WIN32_WCE #include <iostream> ! #include <cstdio> #else #include "WImage/miscdefs.h" *************** *** 28,32 **** ! ColorBuffer::ColorBuffer (int colors, clrmodel cmodel) { m_colors = 0; --- 28,32 ---- ! ColorBuffer::ColorBuffer (int colors, clrmodel cmodel) { m_colors = 0; *************** *** 40,44 **** destroy (); } ! void ColorBuffer::init (int colors, clrmodel cmodel) { --- 40,44 ---- destroy (); } ! void ColorBuffer::init (int colors, clrmodel cmodel) { *************** *** 49,53 **** { m_images = NEW (Image* [m_colors]); ! for (int i = 0; i < m_colors; i++) { --- 49,53 ---- { m_images = NEW (Image* [m_colors]); ! for (int i = 0; i < m_colors; i++) { *************** *** 62,66 **** #ifndef _WIN32_WCE ! int ColorBuffer::fileSize (char const *fname) const { --- 62,66 ---- #ifndef _WIN32_WCE ! int ColorBuffer::fileSize (char const *fname) const { *************** *** 87,92 **** } } ! DELETE (m_images); ! } } --- 87,92 ---- } } ! DELETEAR (m_images); ! } } *************** *** 103,107 **** } ! coeff ColorBuffer::averageColor (int fromY, int fromX, int toY, int toX) { --- 103,107 ---- } ! coeff ColorBuffer::averageColor (int fromY, int fromX, int toY, int toX) { *************** *** 114,118 **** } ! void ColorBuffer::colormodel (clrmodel model) { --- 114,118 ---- } ! void ColorBuffer::colormodel (clrmodel model) { *************** *** 127,131 **** } ! /* This is from * http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html */ --- 127,131 ---- } ! /* This is from * http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html */ *************** *** 168,172 **** throw invalid_argument ("colormodel: unsupported format."); } ! coeff src[3]; coeff dest; --- 168,172 ---- throw invalid_argument ("colormodel: unsupported format."); } ! coeff src[3]; coeff dest; *************** *** 197,201 **** throw invalid_argument ("smin: empty image."); } ! coeff result = m_images[0]->smin (); for (int i = 1; i < m_colors; i++) --- 197,201 ---- throw invalid_argument ("smin: empty image."); } ! coeff result = m_images[0]->smin (); for (int i = 1; i < m_colors; i++) *************** *** 217,221 **** throw invalid_argument ("smax: empty image."); } ! coeff result = m_images[0]->smax (); for (int i = 1; i < m_colors; i++) --- 217,221 ---- throw invalid_argument ("smax: empty image."); } ! coeff result = m_images[0]->smax (); for (int i = 1; i < m_colors; i++) *************** *** 230,234 **** } ! void ColorBuffer::valadjust (void) { --- 230,234 ---- } ! void ColorBuffer::valadjust (void) { *************** *** 236,242 **** coeff cmax = smax (); coeff norm = 1.0; ! DPRINTF (("old max: %.2f, min: %.2f\n", cmax, cmin)); ! if (cmax - cmin > 255.0) { --- 236,242 ---- coeff cmax = smax (); coeff norm = 1.0; ! DPRINTF (("old max: %.2f, min: %.2f\n", cmax, cmin)); ! if (cmax - cmin > 255.0) { *************** *** 257,261 **** cmax = cmin = 0; } ! DPRINTF (("new max: %.2f, min: %.2f\n", cmax, cmin)); for (int i = 0; i < m_images[0]->size (); i++) --- 257,261 ---- cmax = cmin = 0; } ! DPRINTF (("new max: %.2f, min: %.2f\n", cmax, cmin)); for (int i = 0; i < m_images[0]->size (); i++) *************** *** 273,277 **** ! void ColorBuffer::truncate (coeff min, coeff max) { --- 273,277 ---- ! void ColorBuffer::truncate (coeff min, coeff max) { *************** *** 297,301 **** ColorBuffer::equals (ColorBuffer &buf) const { ! return this->epsilons (buf, COEFF_EPSILON); } --- 297,301 ---- ColorBuffer::equals (ColorBuffer &buf) const { ! return this->epsilons (buf, COEFF_EPSILON); ... [truncated message content] |
From: Herbert M. D. <he...@us...> - 2007-08-07 17:01:09
|
Update of /cvsroot/wavelet/Wavelet/test In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6566/test Modified Files: Makefile.in Makefile.msc Makefile.watcomc coeffinfo.cc colorimage.cc filename.cc histogram.cc image.cc imagearray.cc imagefile.cc imageinfo.cc position.cc vectors.cc videos.cc wavelet.cc Added Files: christina57.jpg imageresizer.cc prod_18_schuh1.jpg Log Message: Various bugfixes, added ImageResizer tool class which allows smart cropping of color images (not very sophisticated yet). Index: Makefile.in =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/Makefile.in,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.in 15 Aug 2005 17:09:41 -0000 1.4 --- Makefile.in 7 Aug 2007 17:01:00 -0000 1.5 *************** *** 43,49 **** TESTS = imagearray_test vectors_test position_test imagefile_test \ ! filename_test image_test wavelet_test coeffinfo_test ntree_test \ ! imageinfo_test colorimage_test transform_test histogram_test \ ! videos_test PROGRAMS = $(TESTS:_test=$E) benchmark$E DEPENDS = $(TESTS:_test=.dd) benchmark.dd --- 43,49 ---- TESTS = imagearray_test vectors_test position_test imagefile_test \ ! filename_test image_test wavelet_test coeffinfo_test ntree_test \ ! imageinfo_test colorimage_test transform_test histogram_test \ ! videos_test imageresizer_test PROGRAMS = $(TESTS:_test=$E) benchmark$E DEPENDS = $(TESTS:_test=.dd) benchmark.dd *************** *** 113,116 **** --- 113,120 ---- @-rm -f harin[0-9][0-9]*.pgm harin-*.vid temp-*.avi + imageresizer_test: imageresizer$E + @./$< + @-rm -f harin[0-9][0-9]*.pgm harin-*.vid temp-*.avi + # # Flags passed to the compiler *************** *** 186,189 **** --- 190,196 ---- $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) + imageresizer$E: imageresizer$O ../libwavelet$A + $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) + ../libwavelet$A: ../*.cc ../*.hh ../Wave/*.hh ../*.h $(MAKE) -C ../ static Index: videos.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/videos.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** videos.cc 15 Aug 2005 16:24:23 -0000 1.9 --- videos.cc 7 Aug 2007 17:01:00 -0000 1.10 *************** *** 16,23 **** #endif ! #include <assert.h> #include <iostream> #include <iomanip> ! #include <math.h> #include "WImage/debug.h" #include "WImage/VideoFrame.hh" --- 16,23 ---- #endif ! #include <cassert> #include <iostream> #include <iomanip> ! #include <cmath> #include "WImage/debug.h" #include "WImage/VideoFrame.hh" Index: imagearray.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/imagearray.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** imagearray.cc 15 Aug 2005 16:24:23 -0000 1.4 --- imagearray.cc 7 Aug 2007 17:01:00 -0000 1.5 *************** *** 16,20 **** #endif ! #include <assert.h> #include <iostream> #include <iomanip> --- 16,20 ---- #endif ! #include <cassert> #include <iostream> #include <iomanip> --- NEW FILE: christina57.jpg --- (This appears to be a binary file; contents omitted.) Index: imagefile.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/imagefile.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** imagefile.cc 10 Aug 2005 09:35:23 -0000 1.3 --- imagefile.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 16,25 **** #endif ! #include <math.h> ! #include <assert.h> #include <iostream> #include <stdexcept> #include <iomanip> ! #include <float.h> #include "../ImageArray.cc" #include "WImage/PgmReader.hh" --- 16,25 ---- #endif ! #include <cmath> ! #include <cassert> #include <iostream> #include <stdexcept> #include <iomanip> ! #include <cfloat> #include "../ImageArray.cc" #include "WImage/PgmReader.hh" --- NEW FILE: prod_18_schuh1.jpg --- (This appears to be a binary file; contents omitted.) Index: Makefile.watcomc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/Makefile.watcomc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile.watcomc 30 Nov 2004 15:43:10 -0000 1.3 --- Makefile.watcomc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 5,15 **** filename_test image_test wavelet_test coeffinfo_test ntree_test & imageinfo_test colorimage_test transform_test histogram_test & ! videos_test PROGRAMS = imagearray$E vectors$E position$E imagefile$E filename$E image$E & wavelet$E coeffinfo$E imageinfo$E colorimage$E benchmark$E ntree$E & ! transform$E histogram$E benchmark$E videos$E OBJECTS = imagearray$O vectors$O position$O imagefile$O filename$O image$O & wavelet$O coeffinfo$O imageinfo$O colorimage$O benchmark$O ntree$O & ! transform$O histogram$O benchmark$O videos$O CPPFLAGS = -i=.. -i=..\..\pfi -dDPRINTF="" -dPFI -dJPEG --- 5,15 ---- filename_test image_test wavelet_test coeffinfo_test ntree_test & imageinfo_test colorimage_test transform_test histogram_test & ! videos_test imageresizer_test PROGRAMS = imagearray$E vectors$E position$E imagefile$E filename$E image$E & wavelet$E coeffinfo$E imageinfo$E colorimage$E benchmark$E ntree$E & ! transform$E histogram$E benchmark$E videos$E imageresizer$E OBJECTS = imagearray$O vectors$O position$O imagefile$O filename$O image$O & wavelet$O coeffinfo$O imageinfo$O colorimage$O benchmark$O ntree$O & ! transform$O histogram$O benchmark$O videos$O imageresizer$O CPPFLAGS = -i=.. -i=..\..\pfi -dDPRINTF="" -dPFI -dJPEG *************** *** 81,84 **** --- 81,88 ---- @-del harin[0-9][0-9]*.pgm harin-*.vid + imageresizer_test: imageresizer$E .SYMBOLIC + @.\\imageresizer$E + @-del harin[0-9][0-9]*.pgm harin-*.vid + clean : .SYMBOLIC -del $(PROGRAMS) $(OBJECTS) Index: filename.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/filename.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** filename.cc 10 Aug 2005 09:35:23 -0000 1.4 --- filename.cc 7 Aug 2007 17:01:00 -0000 1.5 *************** *** 13,17 **** #include "WImage/FileName.hh" #include "WImage/miscdefs.h" ! #include <assert.h> #include <iostream> --- 13,17 ---- #include "WImage/FileName.hh" #include "WImage/miscdefs.h" ! #include <cassert> #include <iostream> --- NEW FILE: imageresizer.cc --- /* * Test program for the class ImageResizer * * $Date: 2007/08/07 17:01:00 $ * $Revision: 1.1 $ * */ #ifdef NDEBUG #undef NDEBUG #endif /* NDEBUG */ #include "WImage/StillImage.hh" #include "WImage/ColorImage.hh" #include "WTools/ImageResizer.hh" #include "testing.h" #include <cassert> #include <iostream> #include <iomanip> #include <stdexcept> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) using namespace std; #endif static void testColorDumbResizing (void); static void testGreyscaleDumbResizing (void); int main (void) { cout << "Testing class ImageResizer...\n"; ColorImage *img = NEW (ColorImage ()); ColorImage * result; TEST_NO_EXCEPTION (img->read ("prod_18_schuh1.jpg")); // 768x1024 //TEST_NO_EXCEPTION (img->read ("rita.jpg")); // 768x1024 //TEST_NO_EXCEPTION (img->read ("christina57.jpg")); // 594x448 //TEST_NO_EXCEPTION (img->read ("lena128.ppm")); // 128x128 //int white[3] = { 255, 255, 255 }; int red[3] = { 255, 0, 0 }; ImageResizer ir (*img, Haar, red, 0.001); //TEST_NO_EXCEPTION (result = ir.resize(100, 200)); TEST_NO_EXCEPTION (result = ir.resize(80, 300)); cout << "score: " << 20000 * ir.getInnerAvgPerSize () << endl; //TEST_NO_EXCEPTION (result = ir.resize(340, 300)); //TEST_NO_EXCEPTION (result = ir.resize(64, 64)); TEST_NO_EXCEPTION (result->write("out.jpg")); cout << "Test of class ImageResizer completed successfully.\n"; return 0; testColorDumbResizing (); testGreyscaleDumbResizing (); return 0; } static void testGreyscaleDumbResizing (void) { cout << " ... greyscale dumb resizing... " << endl; Image *img = NEW(StillImage ()); TEST_NO_EXCEPTION (img->read ("lena.pgm")); // 512x448 cout << " source rows: " << img->rows() << ", cols: " << img->cols() << endl; Image *result = NULL; TEST_NO_EXCEPTION(result = img->fitInto(480, 420)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("lena-480x420.pgm")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(480, 420, 255)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("lena-480x420-fill.pgm")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(530, 448)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("lena-530x448.pgm")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(530, 448, 255)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("lena-530x448-fill.pgm")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(440, 530)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("lena-440x530.pgm")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(440, 530, 255)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("lena-440x530-fill.pgm")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(530, 420)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("lena-530x420.pgm")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(530, 420, 255)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("lena-530x420-fill.pgm")); DELETE (result); DELETE(img); } static void testColorDumbResizing (void) { cout << " ... color dumb resizing... " << endl; ColorImage *img = NEW (ColorImage ()); TEST_NO_EXCEPTION (img->read ("christina57.jpg")); // 594x448 cout << " source rows: " << img->rows() << ", cols: " << img->cols() << endl; cout << " source colormodel: " << img->colormodel() << endl; ColorImage *result = NULL; int red[3] = { 255, 0, 0 }; int blue[3] = { 0, 255, 0 }; int green[3] = { 0, 0, 255 }; int white[3] = { 255, 255, 255 }; TEST_NO_EXCEPTION(result = img->fitInto(550, 420)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("christina-550x420.jpg")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(550, 420, red)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("christina-550x420-fill.jpg")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(600, 580)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("christina-600x580.jpg")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(600, 580, blue)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("christina-600x580-fill.jpg")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(550, 420)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("christina-550x420.jpg")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(550, 420, green)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("christina-550x420-fill.jpg")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(680, 400)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("christina-680x400.jpg")); DELETE (result); TEST_NO_EXCEPTION(result = img->fitInto(680, 400, white)); cout << " rows: " << result->rows() << ", cols: " << result->cols() << endl; TEST_NO_EXCEPTION(result->write("christina-680x400-fill.jpg")); DELETE (result); DELETE(img); } Index: wavelet.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/wavelet.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** wavelet.cc 10 Aug 2005 09:35:23 -0000 1.3 --- wavelet.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 15,24 **** #endif ! #include <stdio.h> ! #include <assert.h> #include <iostream> #include <iomanip> ! #include <math.h> ! #include <float.h> #include "../ImageArray.cc" #include "WImage/RowVector.hh" --- 15,24 ---- #endif ! #include <cstdio> ! #include <cassert> #include <iostream> #include <iomanip> ! #include <cmath> ! #include <cfloat> #include "../ImageArray.cc" #include "WImage/RowVector.hh" Index: coeffinfo.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/coeffinfo.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** coeffinfo.cc 10 Aug 2005 09:35:23 -0000 1.2 --- coeffinfo.cc 7 Aug 2007 17:01:00 -0000 1.3 *************** *** 12,16 **** #include "WImage/CoeffInformation.hh" ! #include <assert.h> #include <iostream> --- 12,16 ---- #include "WImage/CoeffInformation.hh" ! #include <cassert> #include <iostream> Index: position.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/position.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** position.cc 10 Aug 2005 09:35:23 -0000 1.3 --- position.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 13,17 **** #include "Wave/MirrorPosition.hh" #include "Wave/PeriodicPosition.hh" ! #include <assert.h> #include <iostream> --- 13,17 ---- #include "Wave/MirrorPosition.hh" #include "Wave/PeriodicPosition.hh" ! #include <cassert> #include <iostream> Index: image.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/image.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** image.cc 22 May 2007 14:55:45 -0000 1.5 --- image.cc 7 Aug 2007 17:01:00 -0000 1.6 *************** *** 11,20 **** #endif /* NDEBUG */ ! #include <assert.h> #include <iostream> #include <iomanip> #include <stdexcept> ! #include <math.h> ! #include <float.h> #include "WImage/StillImage.hh" --- 11,20 ---- #endif /* NDEBUG */ ! #include <cassert> #include <iostream> #include <iomanip> #include <stdexcept> ! #include <cmath> ! #include <cfloat> #include "WImage/StillImage.hh" Index: Makefile.msc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/Makefile.msc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile.msc 30 Nov 2004 15:36:04 -0000 1.3 --- Makefile.msc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 30,37 **** filename_test image_test wavelet_test coeffinfo_test ntree_test \ imageinfo_test colorimage_test transform_test histogram_test \ ! videos_test PROGRAMS = imagearray$E vectors$E position$E imagefile$E filename$E image$E \ wavelet$E coeffinfo$E imageinfo$E colorimage$E benchmark$E ntree$E \ ! transform$E histogram$E videos$E tests: $(TESTS) --- 30,37 ---- filename_test image_test wavelet_test coeffinfo_test ntree_test \ imageinfo_test colorimage_test transform_test histogram_test \ ! videos_test imageresizer_test PROGRAMS = imagearray$E vectors$E position$E imagefile$E filename$E image$E \ wavelet$E coeffinfo$E imageinfo$E colorimage$E benchmark$E ntree$E \ ! transform$E histogram$E videos$E imageresizer$E tests: $(TESTS) *************** *** 97,100 **** --- 97,104 ---- @-del harin[0-9][0-9]*.pgm harin-*.vid + imageresizer_test: imageresizer$E + @.\\imageresizer$E + @-del harin[0-9][0-9]*.pgm harin-*.vid + # # Flags passed to the compiler *************** *** 135,138 **** --- 139,143 ---- histogram$E: histogram$O videos$E: videos$O + imageresizer$E: imageresizer$O clean: Index: colorimage.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/colorimage.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** colorimage.cc 10 Aug 2005 09:35:23 -0000 1.3 --- colorimage.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 10,14 **** */ ! #include <assert.h> #include <iostream> #include <stdexcept> --- 10,14 ---- */ ! #include <cassert> #include <iostream> #include <stdexcept> Index: histogram.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/histogram.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** histogram.cc 10 Aug 2005 09:35:23 -0000 1.3 --- histogram.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 13,17 **** #include "WTools/Histogram.hh" #include "WImage/StillImage.hh" ! #include <assert.h> #include <iostream> #include <iomanip> --- 13,17 ---- #include "WTools/Histogram.hh" #include "WImage/StillImage.hh" ! #include <cassert> #include <iostream> #include <iomanip> Index: imageinfo.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/imageinfo.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** imageinfo.cc 10 Aug 2005 09:35:23 -0000 1.3 --- imageinfo.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 13,22 **** #include "WTools/ImageInformation.hh" #include "WImage/StillImage.hh" ! #include <assert.h> #include <iostream> #include <iomanip> #include <stdexcept> ! #include <stdlib.h> ! #include <math.h> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) --- 13,22 ---- #include "WTools/ImageInformation.hh" #include "WImage/StillImage.hh" ! #include <cassert> #include <iostream> #include <iomanip> #include <stdexcept> ! #include <cstdlib> ! #include <cmath> #if !(defined __WATCOMC__ && __WATCOMC__ < 1230) Index: vectors.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/test/vectors.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** vectors.cc 10 Aug 2005 09:35:23 -0000 1.3 --- vectors.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 16,20 **** #endif ! #include <assert.h> #include <iostream> #include <iomanip> --- 16,20 ---- #endif ! #include <cassert> #include <iostream> #include <iomanip> |
From: Herbert M. D. <he...@us...> - 2007-08-07 17:01:07
|
Update of /cvsroot/wavelet/Wavelet/tools In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6566/tools Modified Files: pgmcompare.cc pgmcount.cc pgmdenoise.cc pgmdiff.cc pgmequalize.cc pgmhist.cc pgminmax.cc pgmpixel.cc pgmscale.cc pgmstats.cc vid2pgm.cc video2grey.cc wavepgm.cc waveppm.cc Log Message: Various bugfixes, added ImageResizer tool class which allows smart cropping of color images (not very sophisticated yet). Index: video2grey.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/video2grey.cc,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** video2grey.cc 10 Aug 2005 09:35:23 -0000 1.13 --- video2grey.cc 7 Aug 2007 17:01:01 -0000 1.14 *************** *** 7,11 **** */ ! #include <assert.h> #include <iostream> #include <stdexcept> --- 7,11 ---- */ ! #include <cassert> #include <iostream> #include <stdexcept> Index: pgmscale.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/pgmscale.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pgmscale.cc 10 Aug 2005 09:35:23 -0000 1.3 --- pgmscale.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 9,15 **** #include <iostream> #include <stdexcept> ! #include <stdio.h> ! #include <math.h> ! #include <assert.h> #include <Wave.hh> --- 9,15 ---- #include <iostream> #include <stdexcept> ! #include <cstdio> ! #include <cmath> ! #include <cassert> #include <Wave.hh> *************** *** 38,42 **** { cerr << "Usage: pgmscale <infile> <outfile> <factor> [optional]" << endl; ! cerr << "Optional: [<function> [<stages> [<filter> [hlfunc [lhfunc]]]]]" << endl; return 1; --- 38,42 ---- { cerr << "Usage: pgmscale <infile> <outfile> <factor> [optional]" << endl; ! cerr << "Optional: [<function> [<stages> [<filter> [hlfunc [lhfunc]]]]]" << endl; return 1; *************** *** 85,89 **** int hlfunc = -1; int lhfunc = -1; ! if (argc > 7) { --- 85,89 ---- int hlfunc = -1; int lhfunc = -1; ! if (argc > 7) { *************** *** 94,98 **** } } ! if (argc > 8) { --- 94,98 ---- } } ! if (argc > 8) { *************** *** 103,108 **** } } ! ! try { --- 103,108 ---- } } ! ! try { *************** *** 116,120 **** WaveletTransform *transform = NULL; ! if (stages > 1) { --- 116,120 ---- WaveletTransform *transform = NULL; ! if (stages > 1) { *************** *** 130,139 **** } } ! Image *image2 = NULL; Image **lh = NULL; Image **hl = NULL; ! if (stages > 1 && lhfunc >= 0) { --- 130,139 ---- } } ! Image *image2 = NULL; Image **lh = NULL; Image **hl = NULL; ! if (stages > 1 && lhfunc >= 0) { *************** *** 147,151 **** } catch (const exception &error) ! { cerr << "Error: " << error.what () << endl; return 1; --- 147,151 ---- } catch (const exception &error) ! { cerr << "Error: " << error.what () << endl; return 1; *************** *** 166,170 **** } catch (const exception &error) ! { cerr << "Error: " << error.what () << endl; return 1; --- 166,170 ---- } catch (const exception &error) ! { cerr << "Error: " << error.what () << endl; return 1; *************** *** 185,193 **** DELETENOTNULL (transform); ! if (stages > 1) { transform = NEW (PyramidTransform (*image2, *filter)); ! if (lhfunc >= 0) { --- 185,193 ---- DELETENOTNULL (transform); ! if (stages > 1) { transform = NEW (PyramidTransform (*image2, *filter)); ! if (lhfunc >= 0) { *************** *** 237,241 **** DELETE (image1); DELETE (image2); ! return 0; } --- 237,241 ---- DELETE (image1); DELETE (image2); ! return 0; } Index: waveppm.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/waveppm.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** waveppm.cc 10 Aug 2005 09:35:23 -0000 1.4 --- waveppm.cc 7 Aug 2007 17:01:01 -0000 1.5 *************** *** 9,15 **** #include <iostream> #include <stdexcept> ! #include <assert.h> ! #include <stdio.h> ! #include <math.h> #include <Wave.hh> --- 9,15 ---- #include <iostream> #include <stdexcept> ! #include <cassert> ! #include <cstdio> ! #include <cmath> #include <Wave.hh> Index: pgmstats.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/pgmstats.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pgmstats.cc 10 Aug 2005 09:35:23 -0000 1.3 --- pgmstats.cc 7 Aug 2007 17:01:01 -0000 1.4 *************** *** 10,14 **** #include <iomanip> #include <stdexcept> ! #include <stdio.h> #include <WTools.hh> --- 10,14 ---- #include <iomanip> #include <stdexcept> ! #include <cstdio> #include <WTools.hh> Index: pgmhist.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/pgmhist.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pgmhist.cc 10 Aug 2005 09:35:23 -0000 1.3 --- pgmhist.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 10,15 **** #include <iomanip> #include <stdexcept> ! #include <stdio.h> ! #include <string.h> #include <WTools.hh> --- 10,15 ---- #include <iomanip> #include <stdexcept> ! #include <cstdio> ! #include <cstring> #include <WTools.hh> Index: pgmcount.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/pgmcount.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pgmcount.cc 10 Aug 2005 09:35:23 -0000 1.3 --- pgmcount.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 9,14 **** #include <iostream> #include <stdexcept> ! #include <stdio.h> ! #include <math.h> #include <WTools.hh> --- 9,14 ---- #include <iostream> #include <stdexcept> ! #include <cstdio> ! #include <cmath> #include <WTools.hh> Index: pgmequalize.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/pgmequalize.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pgmequalize.cc 10 Aug 2005 09:35:23 -0000 1.4 --- pgmequalize.cc 7 Aug 2007 17:01:00 -0000 1.5 *************** *** 9,15 **** #include <iostream> #include <stdexcept> ! #include <stdio.h> ! #include <math.h> ! #include <assert.h> #include <WImage.hh> --- 9,15 ---- #include <iostream> #include <stdexcept> ! #include <cstdio> ! #include <cmath> ! #include <cassert> #include <WImage.hh> Index: vid2pgm.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/vid2pgm.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** vid2pgm.cc 15 Aug 2005 16:24:23 -0000 1.6 --- vid2pgm.cc 7 Aug 2007 17:01:01 -0000 1.7 *************** *** 7,13 **** */ ! #include <assert.h> #include <iostream> ! #include <stdio.h> #include <stdexcept> #include <iomanip> --- 7,13 ---- */ ! #include <cassert> #include <iostream> ! #include <cstdio> #include <stdexcept> #include <iomanip> Index: wavepgm.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/wavepgm.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wavepgm.cc 10 Aug 2005 09:35:23 -0000 1.4 --- wavepgm.cc 7 Aug 2007 17:01:01 -0000 1.5 *************** *** 9,15 **** #include <iostream> #include <stdexcept> ! #include <assert.h> ! #include <stdio.h> ! #include <math.h> #include <Wave.hh> --- 9,15 ---- #include <iostream> #include <stdexcept> ! #include <cassert> ! #include <cstdio> ! #include <cmath> #include <Wave.hh> Index: pgmcompare.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/pgmcompare.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pgmcompare.cc 10 Aug 2005 09:35:23 -0000 1.5 --- pgmcompare.cc 7 Aug 2007 17:01:00 -0000 1.6 *************** *** 10,16 **** #include <iomanip> #include <stdexcept> ! #include <assert.h> ! #include <stdio.h> ! #include <math.h> #include <WTools.hh> --- 10,16 ---- #include <iomanip> #include <stdexcept> ! #include <cassert> ! #include <cstdio> ! #include <cmath> #include <WTools.hh> *************** *** 59,65 **** int myArgc = argc; char **myArgv = argv; ! /* Preliminary steps */ ! cerr << "pgmcompare version " << WAVE_VERSION << " (c) 2001-2004 by Herbert" #ifdef PFI --- 59,65 ---- int myArgc = argc; char **myArgv = argv; ! /* Preliminary steps */ ! cerr << "pgmcompare version " << WAVE_VERSION << " (c) 2001-2004 by Herbert" #ifdef PFI *************** *** 77,81 **** if (myArgc < 3 || myArgc > 5) { ! cerr << "Usage: pgmcompare [-s] <file1> <file2> [<percent> [<type>]]" << endl << " default for percent is " << percent << endl --- 77,81 ---- if (myArgc < 3 || myArgc > 5) { ! cerr << "Usage: pgmcompare [-s] <file1> <file2> [<percent> [<type>]]" << endl << " default for percent is " << percent << endl *************** *** 92,96 **** } } ! if (myArgc > 4) { --- 92,96 ---- } } ! if (myArgc > 4) { *************** *** 103,107 **** type = (imgtype)i; } ! try { --- 103,107 ---- type = (imgtype)i; } ! try { *************** *** 113,117 **** return 1; } ! try { --- 113,117 ---- return 1; } ! try { *************** *** 141,147 **** mse = comparison->cmpmse (); ! rmse = sqrt (mse); psnr = (mse == 0? -1: comparison->cmpsnr ()); ! cout.setf (ios::fixed, ios::floatfield); cout << "MSE: " << std::setprecision (5) << std::setw (11) << mse << endl --- 141,147 ---- mse = comparison->cmpmse (); ! rmse = sqrt (mse); psnr = (mse == 0? -1: comparison->cmpsnr ()); ! cout.setf (ios::fixed, ios::floatfield); cout << "MSE: " << std::setprecision (5) << std::setw (11) << mse << endl *************** *** 162,166 **** } ! try { score = comparison->distlq (percent, filter, type); --- 162,166 ---- } ! try { score = comparison->distlq (percent, filter, type); *************** *** 178,193 **** /* Print the statistics */ ! cout << "L^q: " << std::setprecision (5) << std::setw (11) << score.colors + score.details << endl; ! cout << "Lq_d: " << std::setprecision (5) << std::setw (10) << lqd_norm << endl; ! cout.setf (FMT0, ios::floatfield); cleanup: ! DELETE (img1); DELETE (img2); ! return 0; } --- 178,193 ---- /* Print the statistics */ ! cout << "L^q: " << std::setprecision (5) << std::setw (11) << score.colors + score.details << endl; ! cout << "Lq_d: " << std::setprecision (5) << std::setw (10) << lqd_norm << endl; ! cout.setf (FMT0, ios::floatfield); cleanup: ! DELETE (img1); DELETE (img2); ! return 0; } Index: pgmdiff.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/pgmdiff.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pgmdiff.cc 10 Aug 2005 09:35:23 -0000 1.3 --- pgmdiff.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 9,13 **** #include <iostream> #include <stdexcept> ! #include <stdio.h> #include <WTools.hh> --- 9,13 ---- #include <iostream> #include <stdexcept> ! #include <cstdio> #include <WTools.hh> Index: pgminmax.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/pgminmax.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pgminmax.cc 10 Aug 2005 09:35:23 -0000 1.3 --- pgminmax.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 10,14 **** #include <iomanip> #include <stdexcept> ! #include <stdio.h> #include <WTools.hh> --- 10,14 ---- #include <iomanip> #include <stdexcept> ! #include <cstdio> #include <WTools.hh> Index: pgmpixel.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/pgmpixel.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pgmpixel.cc 10 Aug 2005 09:35:23 -0000 1.3 --- pgmpixel.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 9,14 **** #include <iostream> #include <stdexcept> ! #include <string.h> ! #include <stdio.h> #include <Wave.hh> --- 9,14 ---- #include <iostream> #include <stdexcept> ! #include <cstring> ! #include <cstdio> #include <Wave.hh> Index: pgmdenoise.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/tools/pgmdenoise.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pgmdenoise.cc 10 Aug 2005 09:35:23 -0000 1.3 --- pgmdenoise.cc 7 Aug 2007 17:01:00 -0000 1.4 *************** *** 9,15 **** #include <iostream> #include <stdexcept> ! #include <stdio.h> ! #include <math.h> ! #include <assert.h> #include <WTools.hh> --- 9,15 ---- #include <iostream> #include <stdexcept> ! #include <cstdio> ! #include <cmath> ! #include <cassert> #include <WTools.hh> |
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] |
From: Herbert M. D. <he...@us...> - 2007-08-07 17:01:06
|
Update of /cvsroot/wavelet/Wavelet/WTools In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv6566/WTools Modified Files: ImageComparison.hh Added Files: ImageResizer.hh Log Message: Various bugfixes, added ImageResizer tool class which allows smart cropping of color images (not very sophisticated yet). Index: ImageComparison.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WTools/ImageComparison.hh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ImageComparison.hh 12 Jul 2005 14:52:19 -0000 1.4 --- ImageComparison.hh 7 Aug 2007 17:01:00 -0000 1.5 *************** *** 1,4 **** /* ! * class Image * * $Date$ --- 1,4 ---- /* ! * class ImageComparison * * $Date$ --- NEW FILE: ImageResizer.hh --- /* * class ImageResizer * * $Date: 2007/08/07 17:01:00 $ * $Revision: 1.1 $ * */ #ifndef IMAGE_RESIZER_HH__ #define IMAGE_RESIZER_HH__ #include "WImage/ColorImage.hh" #include "Wave/WaveletTransform.hh" /** * @addtogroup WTools * @{ */ /** * A class for advanced resizing of images, i.e. wavelet-based * techniques can be used to intelligently crop images to fit */ class ImageResizer { public: /** * Constructor, loads an image, sets Wavelet to be used. * @param img a reference to the image * @param flt a reference to the filterset * @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 threshold the threshold for the aggressiveness of the * cropping (< 1), the higher the more aggressive, default is 0.001 * @param scalingStrategy the scaling strategy (0: bilinear * interpolation, 1: average, 2: nearest neighbour). * @return a new rescaled image */ ImageResizer (const ColorImage &img, FilterSet &flt, int *fill = NULL, coeff threshold = 0.001, int scalingStrategy = 0); /** * Destructor. Cleans up if necessary. */ ~ImageResizer (void); /** Create a resized image's of x/y dimensions. The result image will be * cropped to optimally fit in the new dimensions. The maximal percentage * of cropping as well as the thresholds for guessing insignificant areas * can be set. * The new dimensions must all be greater than zero. * @exception invalid_argument * one or both dimensions are either negative or zero * @param rows * the new number of rows * @param cols * the new number of cols * @param steps the number of steps to decompose before checking for features * @return the new resized image */ ColorImage* resize (int rows, int cols, int steps = 1); /** * Return the inner (absolute) average per size (used for quality measurements) * @return the inner average per size */ inline double getInnerAvgPerSize (void) { return m_innerAvgPerSize; } /** * Return the inner standard deviation (used for quality measurements) * @return the inner standard deviation */ inline double getInnerSDeviation (void) { return m_innerSDeviation; } /** * Return the threshold for cropping-while-resizing * @return the threshold for cropping-while-resizing */ inline double threshold (void) { return m_threshold; } /** * Set the threshold for cropping-while-resizing * @param threshold the threshold for cropping-while-resizing */ inline void threshold (double threshold) { m_threshold = threshold; } protected: /** * Calculate the image's new dimensions * @param rows the number of rows * @param cols the number of cols */ void calcDimensions (int rows, int cols); /** * Calculate average and standard deviation for the regions either top and * bottom or left and right (depending on the value of m_cropWhat) and the * region between for a given number of rows/columns symetrically from the * boundaries to the center of the image. * @param img the image on which to perform the stats * @param nVecs the number of vectors (i.e. rows/columns) over which to * calculate * @param outerAvg (out parameter) is where the calculated average for the * regions to crop is stored * @param outerSDev (out parameter) is where the calculated standard * deviation for the regions to crop is stored * @param innerAvg (out parameter) is where the calculated average for * the region between is stored * @param innerSDev (out parameter) is where the calculated standard * deviation for the region between is stored */ void calcStats (Image &img, int nVecs, coeff &outerAvg, coeff &outerSDev, coeff &innerAvg, coeff &innerSDev); /** * Prepare the result image and the transform * @param rows the number of rows * @param cols the number of cols * @param steps the number of decomposition steps * @return the max values image from the detail areas */ Image *prepareImage (int rows, int cols, int steps); /** * Create the final result image using the previously calculated number of * vectors to discard. * @param rows the number of rows * @param cols the number of cols * @param nDiscardEach the number of rows/cols to discard on each side * (i.e. we actually discard 2 * nDiscard overall); if less than or equal * to zero, nothing will be discarded */ void doResizeImage (int rows, int cols, int nDiscardEach); const ColorImage &m_image; ColorImage *m_resized; FilterSet &m_filter; WaveletTransform *m_transform; float m_qRows; float m_qCols; float m_factor; int m_useRows; int m_useCols; int *m_fill; int m_scalingStrategy; double m_innerAvgPerSize; double m_innerSDeviation; coeff m_threshold; enum { CROP_COLS, CROP_ROWS } m_cropWhat; }; /** @} */ #endif // IMAGE_RESIZER_HH__ |
From: Herbert M. D. <he...@us...> - 2007-05-25 08:08:46
|
Update of /cvsroot/wavelet/Wavelet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18996 Modified Files: WaveletTransform.cc Log Message: Added WaveletTransform::highMax() method. Index: WaveletTransform.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WaveletTransform.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** WaveletTransform.cc 10 Aug 2005 09:35:23 -0000 1.6 --- WaveletTransform.cc 25 May 2007 08:08:09 -0000 1.7 *************** *** 12,20 **** #include "WImage/tools.h" #include <stdexcept> ! #include <assert.h> ! #include <math.h> #ifndef _WIN32_WCE #include <iostream> ! #else #include "WImage/miscdefs.h" #endif --- 12,20 ---- #include "WImage/tools.h" #include <stdexcept> ! #include <cassert> ! #include <cmath> #ifndef _WIN32_WCE #include <iostream> ! #else #include "WImage/miscdefs.h" #endif *************** *** 27,31 **** WaveletTransform::sanity (void) { ! if (m_image->rows () != m_buffer->rows () || m_image->cols () != m_buffer->cols ()) { --- 27,31 ---- WaveletTransform::sanity (void) { ! if (m_image->rows () != m_buffer->rows () || m_image->cols () != m_buffer->cols ()) { *************** *** 34,43 **** } ! void WaveletTransform::expandImage (void) { int powerY = 0; int powerX = 0; ! if (!tools_powerOfTwo (m_image->rows (), powerY) || m_image->rows () != m_image->cols ()) --- 34,43 ---- } ! void WaveletTransform::expandImage (void) { int powerY = 0; int powerX = 0; ! if (!tools_powerOfTwo (m_image->rows (), powerY) || m_image->rows () != m_image->cols ()) *************** *** 56,60 **** ! void WaveletTransform::restoreImage (void) { --- 56,60 ---- ! void WaveletTransform::restoreImage (void) { *************** *** 64,68 **** ! void WaveletTransform::analysis (int steps) { --- 64,68 ---- ! void WaveletTransform::analysis (int steps) { *************** *** 78,82 **** } ! void WaveletTransform::synthesis (int steps, int prevSteps) { --- 78,82 ---- } ! void WaveletTransform::synthesis (int steps, int prevSteps) { *************** *** 98,105 **** WaveletTransform::WaveletTransform (Image &img, FilterSet &fil) ! { ! m_image = &img; m_filter = &fil; ! m_wavelet = NEW (Wavelet (fil)); m_buffer = m_image->clone (); m_rows = m_image->rows (); --- 98,105 ---- WaveletTransform::WaveletTransform (Image &img, FilterSet &fil) ! { ! m_image = &img; m_filter = &fil; ! m_wavelet = NEW (Wavelet (fil)); m_buffer = m_image->clone (); m_rows = m_image->rows (); *************** *** 119,128 **** int yoffs = 0, xoffs = 0, ysize = 0, xsize = 0; where (what, steps, yoffs, xoffs, ysize, xsize); ! DPRINTF (("crop (%d, %d, %d, %d)\n", yoffs, xoffs, ysize, xsize)); return m_image->crop (yoffs, xoffs, ysize, xsize); } ! ! void WaveletTransform::import (Image &img, area what, int steps) { --- 119,155 ---- int yoffs = 0, xoffs = 0, ysize = 0, xsize = 0; where (what, steps, yoffs, xoffs, ysize, xsize); ! DPRINTF (("crop (%d, %d, %d, %d)\n", yoffs, xoffs, ysize, xsize)); return m_image->crop (yoffs, xoffs, ysize, xsize); } ! ! ! Image * ! WaveletTransform::highMax (int steps) ! { ! int yoffs = 0, xoffs = 0, ysize = 0, xsize = 0; ! area what; ! Image *ret = subband (HL, steps); ! ! for (int a = (int)LH; a < (int)areaINVALID; a++) ! { ! what = (area)a; ! where (what, steps, yoffs, xoffs, ysize, xsize); ! for (int y = 0; y < ysize; y++) ! { ! for (int x = 0; x < xsize; x++) ! { ! if (fabs (m_image->at (y + yoffs, x + xoffs)) ! > fabs (ret->at (y, x))) ! { ! ret->to (y, x, m_image->at (y + yoffs, x + xoffs)); ! } ! } ! } ! } ! return ret; ! } ! ! void WaveletTransform::import (Image &img, area what, int steps) { *************** *** 134,148 **** "dimensions don't match the subband size."); } ! DPRINTF (("import: area: %d, yoffs: %d, xoffs: %d\n", (int)what, yoffs, xoffs)); m_image->paste (yoffs, xoffs, img); } ! void WaveletTransform::fill (coeff value, area what, int steps) { int yoffs = 0, xoffs = 0, ysize = 0, xsize = 0; where (what, steps, yoffs, xoffs, ysize, xsize); ! DPRINTF (("fill: area: %d, yoffs: %d, xoffs: %d, value: %f\n", (int)what, yoffs, xoffs, value)); for (int row = 0; row < ysize; row++) --- 161,175 ---- "dimensions don't match the subband size."); } ! DPRINTF (("import: area: %d, yoffs: %d, xoffs: %d\n", (int)what, yoffs, xoffs)); m_image->paste (yoffs, xoffs, img); } ! void WaveletTransform::fill (coeff value, area what, int steps) { int yoffs = 0, xoffs = 0, ysize = 0, xsize = 0; where (what, steps, yoffs, xoffs, ysize, xsize); ! DPRINTF (("fill: area: %d, yoffs: %d, xoffs: %d, value: %f\n", (int)what, yoffs, xoffs, value)); for (int row = 0; row < ysize; row++) *************** *** 156,160 **** void ! WaveletTransform::where (area what, int subband, int &yoffs, int &xoffs, int &ysize, int &xsize) const { --- 183,187 ---- void ! WaveletTransform::where (area what, int subband, int &yoffs, int &xoffs, int &ysize, int &xsize) const { *************** *** 166,173 **** xoffs = yoffs = 0; ! ! DPRINTF (("subband: %d, anasteps: %d, synsteps: %d\n", subband, m_image->anasteps (), m_image->synsteps ())); ! ysize = m_image->rows () / TWOPOW (subband); xsize = m_image->cols () / TWOPOW (subband); --- 193,200 ---- xoffs = yoffs = 0; ! ! DPRINTF (("subband: %d, anasteps: %d, synsteps: %d\n", subband, m_image->anasteps (), m_image->synsteps ())); ! ysize = m_image->rows () / TWOPOW (subband); xsize = m_image->cols () / TWOPOW (subband); *************** *** 193,198 **** xsize = m_image->cols () / TWOPOW (subband); } ! ! DPRINTF (("area: %d, yoffs: %d, xoffs: %d, ysize: %d, xsize: %d\n", (int)what, yoffs, xoffs, ysize, xsize)); assert (yoffs + ysize <= m_image->rows ()); --- 220,225 ---- xsize = m_image->cols () / TWOPOW (subband); } ! ! DPRINTF (("area: %d, yoffs: %d, xoffs: %d, ysize: %d, xsize: %d\n", (int)what, yoffs, xoffs, ysize, xsize)); assert (yoffs + ysize <= m_image->rows ()); *************** *** 200,205 **** } ! void ! WaveletTransform::where (int ypos, int xpos, int &subband, area &channel, int steps) const { --- 227,232 ---- } ! void ! WaveletTransform::where (int ypos, int xpos, int &subband, area &channel, int steps) const { *************** *** 226,232 **** } ! void ! WaveletTransform::mapPosition (int yOld, int xOld, int toSubband, ! area toChannel, int &yNew, int &xNew, int &sizeFactor, int steps) const { --- 253,259 ---- } ! void ! WaveletTransform::mapPosition (int yOld, int xOld, int toSubband, ! area toChannel, int &yNew, int &xNew, int &sizeFactor, int steps) const { *************** *** 235,239 **** int y1 = 0, x1 = 0, h1 = 0, w1 = 0; int y2 = 0, x2 = 0, h2 = 0, w2 = 0; ! where (yOld, xOld, fromSubband, fromChannel, steps); where (fromChannel, fromSubband, y1, x1, h1, w1); --- 262,266 ---- int y1 = 0, x1 = 0, h1 = 0, w1 = 0; int y2 = 0, x2 = 0, h2 = 0, w2 = 0; ! where (yOld, xOld, fromSubband, fromChannel, steps); where (fromChannel, fromSubband, y1, x1, h1, w1); *************** *** 241,245 **** sizeFactor = h2 / h1; ! /* calculate the destination (mapped) coordinates from their relative * channel position and the two channels' coordinates... */ --- 268,272 ---- sizeFactor = h2 / h1; ! /* calculate the destination (mapped) coordinates from their relative * channel position and the two channels' coordinates... */ *************** *** 250,254 **** } ! coeff WaveletTransform::ratio (int subband1, int subband2) { --- 277,281 ---- } ! coeff WaveletTransform::ratio (int subband1, int subband2) { *************** *** 256,260 **** } ! int WaveletTransform::getSubband (int ypos, int xpos, int steps) { --- 283,287 ---- } ! int WaveletTransform::getSubband (int ypos, int xpos, int steps) { *************** *** 274,278 **** } ! coeff WaveletTransform::saverage (int subband, area channel) const { --- 301,305 ---- } ! coeff WaveletTransform::saverage (int subband, area channel) const { *************** *** 283,287 **** ! coeff WaveletTransform::aaverage (int subband, area channel) const { --- 310,314 ---- ! coeff WaveletTransform::aaverage (int subband, area channel) const { *************** *** 292,296 **** ! coeff WaveletTransform::sqvariance (int subband, area channel) const { --- 319,323 ---- ! coeff WaveletTransform::sqvariance (int subband, area channel) const { *************** *** 300,304 **** } ! coeff WaveletTransform::variance (int subband, area channel, bool abs) const { --- 327,331 ---- } ! coeff WaveletTransform::variance (int subband, area channel, bool abs) const { *************** *** 309,313 **** ! coeff WaveletTransform::sdeviation (int subband, area channel, bool abs) const { --- 336,340 ---- ! coeff WaveletTransform::sdeviation (int subband, area channel, bool abs) const { |
From: Herbert M. D. <he...@us...> - 2007-05-25 08:08:19
|
Update of /cvsroot/wavelet/Wavelet/Wave In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18996/Wave Modified Files: WaveletTransform.hh Log Message: Added WaveletTransform::highMax() method. Index: WaveletTransform.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Wave/WaveletTransform.hh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** WaveletTransform.hh 12 Jul 2005 14:52:20 -0000 1.4 --- WaveletTransform.hh 25 May 2007 08:08:12 -0000 1.5 *************** *** 7,13 **** */ ! /** ! * @addtogroup Wave ! * @{ */ --- 7,13 ---- */ ! /** ! * @addtogroup Wave ! * @{ */ *************** *** 19,28 **** #include "Wave/Filter.hh" ! /** ! * An abstract Wavelet Transform. The Transform transform is two-dimensional, * it thus works on images. */ /*abstract*/ ! class WaveletTransform { --- 19,28 ---- #include "Wave/Filter.hh" ! /** ! * An abstract Wavelet Transform. The Transform transform is two-dimensional, * it thus works on images. */ /*abstract*/ ! class WaveletTransform { *************** *** 37,41 **** virtual ~WaveletTransform (void); ! /** Perform a Wavelet transform on the image. * @exception invalid_argument * image is not square --- 37,41 ---- virtual ~WaveletTransform (void); ! /** Perform a Wavelet transform on the image. * @exception invalid_argument * image is not square *************** *** 43,52 **** * the number of transform steps */ virtual void analysis (int steps); ! /** Perform an inverse Wavelet transform on the image. * @exception invalid_argument * image is not square * @param steps ! * the number of inverse transform steps ! * @param prevSteps * if greater than 0, the number of previous decomposition steps * to assume. This is necessary to reconstruct images that are --- 43,52 ---- * the number of transform steps */ virtual void analysis (int steps); ! /** Perform an inverse Wavelet transform on the image. * @exception invalid_argument * image is not square * @param steps ! * the number of inverse transform steps ! * @param prevSteps * if greater than 0, the number of previous decomposition steps * to assume. This is necessary to reconstruct images that are *************** *** 59,67 **** void restoreImage (void); ! /** Identify position and size of a given channel in a given subband. ! * This default method of calculation refers to the Pyramid transform ! * and due to the lack of alternatives also to the Standard transform. ! * Decomposition schemes using a different geometries, like e.g. the ! * Packet transform may have to implement their own version of that * method. * @param what --- 59,67 ---- void restoreImage (void); ! /** Identify position and size of a given channel in a given subband. ! * This default method of calculation refers to the Pyramid transform ! * and due to the lack of alternatives also to the Standard transform. ! * Decomposition schemes using a different geometries, like e.g. the ! * Packet transform may have to implement their own version of that * method. * @param what *************** *** 77,81 **** * @param xsize * the returned number of cols */ ! virtual void where (area what, int subband, int &yoffs, int &xoffs, int &ysize, int &xsize) const; --- 77,81 ---- * @param xsize * the returned number of cols */ ! virtual void where (area what, int subband, int &yoffs, int &xoffs, int &ysize, int &xsize) const; *************** *** 90,106 **** * where the calculated subband gets written to. * @param channel ! * where the calculated channel gets written to. * @param steps * the current number of transform steps to be assumed (-1 for automatic * determination) */ ! virtual void where (int ypos, int xpos, int &subband, area &channel, int steps = -1) const; ! /** Identify channel and subband of a given position in the transformed * image and map it to another subband/channel. ! * This default method of calculation refers to the Pyramid transform ! * and due to the lack of alternatives also to the Standard transform. ! * Decomposition schemes using a different geometries, like e.g. the ! * Packet transform may have to implement their own version of that * method. * @param yOld --- 90,106 ---- * where the calculated subband gets written to. * @param channel ! * where the calculated channel gets written to. * @param steps * the current number of transform steps to be assumed (-1 for automatic * determination) */ ! virtual void where (int ypos, int xpos, int &subband, area &channel, int steps = -1) const; ! /** Identify channel and subband of a given position in the transformed * image and map it to another subband/channel. ! * This default method of calculation refers to the Pyramid transform ! * and due to the lack of alternatives also to the Standard transform. ! * Decomposition schemes using a different geometries, like e.g. the ! * Packet transform may have to implement their own version of that * method. * @param yOld *************** *** 117,129 **** * where the target location's column gets written to. * @param sizeFactor ! * where the target sizeFactor gets written to. * @param steps * the current number of transform steps to be assumed (-1 for automatic * determination) */ ! virtual void mapPosition (int yOld, int xOld, int toSubband, ! area toChannel, int &yNew, int &xNew, int &sizeFactor, int steps = -1) const; ! ! /** Return the average color for a particular area in a subband * inside the image. The coefficients' signedness will be considered. * This is a shortcut to the corresponding method in the Image class. --- 117,129 ---- * where the target location's column gets written to. * @param sizeFactor ! * where the target sizeFactor gets written to. * @param steps * the current number of transform steps to be assumed (-1 for automatic * determination) */ ! virtual void mapPosition (int yOld, int xOld, int toSubband, ! area toChannel, int &yNew, int &xNew, int &sizeFactor, int steps = -1) const; ! ! /** Return the average color for a particular area in a subband * inside the image. The coefficients' signedness will be considered. * This is a shortcut to the corresponding method in the Image class. *************** *** 133,137 **** virtual coeff saverage (int subband, area channel) const; ! /** Return the average color for a particular area in a subband * inside the image. The coefficients' signedness will be discarded. * This is a shortcut to the corresponding method in the Image class. --- 133,137 ---- virtual coeff saverage (int subband, area channel) const; ! /** Return the average color for a particular area in a subband * inside the image. The coefficients' signedness will be discarded. * This is a shortcut to the corresponding method in the Image class. *************** *** 141,145 **** virtual coeff aaverage (int subband, area channel) const; ! /** Return the square variance for a particular area in a subband * inside the image. * This is a shortcut to the corresponding method in the Image class. --- 141,145 ---- virtual coeff aaverage (int subband, area channel) const; ! /** Return the square variance for a particular area in a subband * inside the image. * This is a shortcut to the corresponding method in the Image class. *************** *** 149,153 **** virtual coeff sqvariance (int subband, area channel) const; ! /** Return the variance for a particular area in a subband * inside the image. * This is a shortcut to the corresponding method in the Image class. --- 149,153 ---- virtual coeff sqvariance (int subband, area channel) const; ! /** Return the variance for a particular area in a subband * inside the image. * This is a shortcut to the corresponding method in the Image class. *************** *** 158,162 **** virtual coeff variance (int subband, area channel, bool abs = false) const; ! /** Returns the standard deviation for a particular area in a subband * inside the image. * This is a shortcut to the corresponding method in the Image class. --- 158,162 ---- virtual coeff variance (int subband, area channel, bool abs = false) const; ! /** Returns the standard deviation for a particular area in a subband * inside the image. * This is a shortcut to the corresponding method in the Image class. *************** *** 166,175 **** * @return the standard deviation. */ virtual coeff sdeviation (int subband, area channel, bool abs = false) const; ! /** Return the ratio resulting from the zerotree relationship between ! * two subbands (e.g. 1:4 from subband 1 to 2). This method depends on the ! * geometry associated with the `Pyramid' decomposition. ! * Decomposition schemes using a different geometries, like e.g. the ! * Packet transform may have to implement their own version of that * method. * @param subband1 the first subband --- 166,175 ---- * @return the standard deviation. */ virtual coeff sdeviation (int subband, area channel, bool abs = false) const; ! /** Return the ratio resulting from the zerotree relationship between ! * two subbands (e.g. 1:4 from subband 1 to 2). This method depends on the ! * geometry associated with the `Pyramid' decomposition. ! * Decomposition schemes using a different geometries, like e.g. the ! * Packet transform may have to implement their own version of that * method. * @param subband1 the first subband *************** *** 177,208 **** * @return the ratio, e.g. 4 for 1:4 */ virtual coeff ratio (int subband1, int subband2); ! ! /** Get a subpicture containing the LL subband. * @param steps * assume number of transform steps instead of those computed from * the previous transforms */ inline Image *ll (int steps = -1) { return subband (LL, steps); } ! /** Get a subpicture containing the HL subband. * @param steps * assume number of transform steps instead of those computed from * the previous transforms */ inline Image *hl (int steps = -1) { return subband (HL, steps); } ! /** Get a subpicture containing the LH subband. * @param steps * assume number of transform steps instead of those computed from * the previous transforms */ inline Image *lh (int steps = -1) { return subband (LH, steps); } ! /** Get a subpicture containing the HH subband. * @param steps * assume number of transform steps instead of those computed from * the previous transforms */ inline Image *hh (int steps = -1) { return subband (HH, steps); } /** Get a reference to the image * @return the reference to the image */ inline Image &image (void) const { return *m_image; } ! /** Get a subpicture containing one of the subbands. * @param what ! * the subband, out of LL, HL, LH, HH * @param steps * assume number of transform steps instead of those computed from --- 177,216 ---- * @return the ratio, e.g. 4 for 1:4 */ virtual coeff ratio (int subband1, int subband2); ! ! /** Get a subpicture containing the LL subband. * @param steps * assume number of transform steps instead of those computed from * the previous transforms */ inline Image *ll (int steps = -1) { return subband (LL, steps); } ! /** Get a subpicture containing the HL subband. * @param steps * assume number of transform steps instead of those computed from * the previous transforms */ inline Image *hl (int steps = -1) { return subband (HL, steps); } ! /** Get a subpicture containing the LH subband. * @param steps * assume number of transform steps instead of those computed from * the previous transforms */ inline Image *lh (int steps = -1) { return subband (LH, steps); } ! /** Get a subpicture containing the HH subband. * @param steps * assume number of transform steps instead of those computed from * the previous transforms */ inline Image *hh (int steps = -1) { return subband (HH, steps); } + /** + * Get an image consisting of the given subband's highpass components + * maxima. + * @param steps + * assume number of transform steps instead of those computed from + * @return a new image object containing the maxima as coefficients + */ + Image *highMax(int steps = -1); /** Get a reference to the image * @return the reference to the image */ inline Image &image (void) const { return *m_image; } ! /** Get a subpicture containing one of the subbands. * @param what ! * the subband, out of LL, HL, LH, HH * @param steps * assume number of transform steps instead of those computed from *************** *** 210,217 **** virtual Image *subband (area what, int steps = -1); ! /** Get the subband of a given position in the image. This ! * default method of calculation refers to the Pyramid transform and due ! * to the lack of alternatives also to the Standard transform. ! * Decomposition schemes using a different geometries, like e.g. the * Packet transform may have to implement their own version of that method. * @param ypos --- 218,225 ---- virtual Image *subband (area what, int steps = -1); ! /** Get the subband of a given position in the image. This ! * default method of calculation refers to the Pyramid transform and due ! * to the lack of alternatives also to the Standard transform. ! * Decomposition schemes using a different geometries, like e.g. the * Packet transform may have to implement their own version of that method. * @param ypos *************** *** 221,232 **** * @param steps * the number of steps we assume the image to have been transformed ! * @return * the position's subband */ virtual int getSubband (int ypos, int xpos, int steps = -1); /** Get the subband of a given position in the image denoted by a ! * {\em CoeffInformation} object. ! * This default method of calculation refers to the Pyramid transform and ! * due * to the lack of alternatives also to the Standard transform. ! * Decomposition schemes using a different geometries, like e.g. the * Packet transform may have to implement their own version of that method. * @param c --- 229,240 ---- * @param steps * the number of steps we assume the image to have been transformed ! * @return * the position's subband */ virtual int getSubband (int ypos, int xpos, int steps = -1); /** Get the subband of a given position in the image denoted by a ! * {\em CoeffInformation} object. ! * This default method of calculation refers to the Pyramid transform and ! * due * to the lack of alternatives also to the Standard transform. ! * Decomposition schemes using a different geometries, like e.g. the * Packet transform may have to implement their own version of that method. * @param c *************** *** 234,238 **** * @param steps * the number of steps we assume the image to have been transformed ! * @return * the position's subband */ inline int getSubband (CoeffInformation &c, int steps = -1) { --- 242,246 ---- * @param steps * the number of steps we assume the image to have been transformed ! * @return * the position's subband */ inline int getSubband (CoeffInformation &c, int steps = -1) { *************** *** 240,247 **** } ! /** Get the area of a given position in the image. This ! * default method of calculation refers to the Pyramid transform and due ! * to the lack of alternatives also to the Standard transform. ! * Decomposition schemes using a different geometries, like e.g. the * Packet transform may have to implement their own version of that method. * @param ypos --- 248,255 ---- } ! /** Get the area of a given position in the image. This ! * default method of calculation refers to the Pyramid transform and due ! * to the lack of alternatives also to the Standard transform. ! * Decomposition schemes using a different geometries, like e.g. the * Packet transform may have to implement their own version of that method. * @param ypos *************** *** 251,262 **** * @param steps * the number of steps we assume the image to have been transformed ! * @return * the position's subband */ virtual area getArea (int ypos, int xpos, int steps = -1); /** Get the area of a given position in the image denoted by a ! * {\em CoeffInformation} object. ! * This default method of calculation refers to the Pyramid transform and ! * due * to the lack of alternatives also to the Standard transform. ! * Decomposition schemes using a different geometries, like e.g. the * Packet transform may have to implement their own version of that method. * @param c --- 259,270 ---- * @param steps * the number of steps we assume the image to have been transformed ! * @return * the position's subband */ virtual area getArea (int ypos, int xpos, int steps = -1); /** Get the area of a given position in the image denoted by a ! * {\em CoeffInformation} object. ! * This default method of calculation refers to the Pyramid transform and ! * due * to the lack of alternatives also to the Standard transform. ! * Decomposition schemes using a different geometries, like e.g. the * Packet transform may have to implement their own version of that method. * @param c *************** *** 264,268 **** * @param steps * the number of steps we assume the image to have been transformed ! * @return * the position's subband */ inline area getArea (CoeffInformation &c, int steps = -1) { --- 272,276 ---- * @param steps * the number of steps we assume the image to have been transformed ! * @return * the position's subband */ inline area getArea (CoeffInformation &c, int steps = -1) { *************** *** 270,274 **** } ! /** Import a subpicture containing one of the subbands. * @exception invalid_argument * the imported image does not match the calculated subband size --- 278,282 ---- } ! /** Import a subpicture containing one of the subbands. * @exception invalid_argument * the imported image does not match the calculated subband size *************** *** 276,280 **** * the image containing the subband * @param what ! * the subband, out of LL, HL, LH, HH * @param steps * assume number of transform steps instead of those computed from --- 284,288 ---- * the image containing the subband * @param what ! * the subband, out of LL, HL, LH, HH * @param steps * assume number of transform steps instead of those computed from *************** *** 282,286 **** virtual void import (Image &img, area what, int steps = -1); ! /** Fill one of the subbands with one particular value. * @exception invalid_argument * the imported image does not match the calculated subband size --- 290,294 ---- virtual void import (Image &img, area what, int steps = -1); ! /** Fill one of the subbands with one particular value. * @exception invalid_argument * the imported image does not match the calculated subband size *************** *** 288,304 **** * the value to be inserted * @param what ! * the subband, out of LL, HL, LH, HH * @param steps * assume number of transform steps instead of those computed from * the previous transforms */ virtual void fill (coeff value, area what, int steps = -1); ! ! /** Return the current number of decomposition steps * @return the number of decomposition steps */ ! inline int steps (void) const { return m_image->anasteps () - m_image->synsteps (); } #ifdef USE_DEPRECATED_API ! inline void import (Image &img, area what, int steps = -1) { import &img, what, steps); } #endif --- 296,312 ---- * the value to be inserted * @param what ! * the subband, out of LL, HL, LH, HH * @param steps * assume number of transform steps instead of those computed from * the previous transforms */ virtual void fill (coeff value, area what, int steps = -1); ! ! /** Return the current number of decomposition steps * @return the number of decomposition steps */ ! inline int steps (void) const { return m_image->anasteps () - m_image->synsteps (); } #ifdef USE_DEPRECATED_API ! inline void import (Image &img, area what, int steps = -1) { import &img, what, steps); } #endif *************** *** 320,331 **** int m_cols; ! /** Perform a Wavelet transform on the image. * @param steps * the number of transform steps */ virtual void doanalysis (int steps) = 0; ! /** Perform an inverse Wavelet transform on the image. * @param steps ! * the number of inverse transform steps ! * @param prevSteps * if greater than 0, the number of previous decomposition steps * to assume. This is necessary to reconstruct images that are --- 328,339 ---- int m_cols; ! /** Perform a Wavelet transform on the image. * @param steps * the number of transform steps */ virtual void doanalysis (int steps) = 0; ! /** Perform an inverse Wavelet transform on the image. * @param steps ! * the number of inverse transform steps ! * @param prevSteps * if greater than 0, the number of previous decomposition steps * to assume. This is necessary to reconstruct images that are |