[Wavelet-commit] Wavelet/WImage ColorImage.hh, 1.8, 1.9 Image.hh, 1.19, 1.20
Status: Beta
Brought to you by:
herbert
From: Herbert M. D. <he...@us...> - 2009-04-12 16:57:58
|
Update of /cvsroot/wavelet/Wavelet/WImage In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv19809/WImage Modified Files: ColorImage.hh Image.hh Log Message: Added option for mirror extension when resizing an image using fitInto(), made method for calculating the Lq feature vector static in ImageComparison. Index: Image.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage/Image.hh,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Image.hh 17 Apr 2008 07:27:35 -0000 1.19 --- Image.hh 12 Apr 2009 16:57:53 -0000 1.20 *************** *** 23,26 **** --- 23,57 ---- * @{ */ + class Image; + + /** + * An abstract functor for filling empty regions when resizing images. + */ + /* abstract */ + class ResizeFillFunc { + public: + /** + * Calculate the falue for an otherwise empty position. + * @param scaled + * the scaled image (yet to fill with values) + * @param factor + * the factor + * @param y + * the row in the image + * @param x + * the column in the image + * @param newRows + * the number of rows in the scaled image + * @param newCols + * the number of columns in the scaled image + * @param yOffset + * the empty region to the image's top (if any) + * @param xOffset + * the empty region to the image's left (if any) + */ + virtual coeff operator() (const Image &scaled, double factor, int y, int x, + int newY, int newX, int yOffset, int xOffset) = 0; + }; + /** * An image (abstract). A (grey-scale) more-than-one-dimensional image. *************** *** 558,561 **** --- 589,629 ---- int fill = -1, int function = 0) const; + /** 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 mirrorExtend if true, the otherwise empty regions of the image + * are extended by a mirroring function + * (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, bool mirrorExtend, + int function = 0) const; + + /** 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 fillFunc if not NULL a function for filling otherwise empty regions + * (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, ResizeFillFunc *fillFunc, + int function = 0) const; + /** Produce a scaled version of the image. The aspect ratio will remain * the same. Index: ColorImage.hh =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WImage/ColorImage.hh,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ColorImage.hh 17 Apr 2008 07:27:35 -0000 1.8 --- ColorImage.hh 12 Apr 2009 16:57:53 -0000 1.9 *************** *** 225,228 **** --- 225,265 ---- int *fill = NULL, int function = 0) const; + /** 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 mirrorExtend if true, the otherwise empty regions of the image + * are extended by a mirroring function + * (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, bool mirrorExtend, + int function = 0) const; + + /** 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 fillFunc if not NULL a function for filling otherwise empty regions + * (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, ResizeFillFunc *fillFunc, + int function = 0) const; + /** Produce a scaled version of the image. The aspect ratio will remain * the same. |