|
Wavelet and Image class library
1.3.2
|
#include <ColorImage.hh>


Public Member Functions | |
| ColorImage (int colors=3, clrmodel cmodel=cm_rgb, Image **images=NULL, bool isReference=false, bool isMine=false) | |
| ColorImage (int rows, int cols, int colors=3, clrmodel cmodel=cm_rgb) | |
| virtual | ~ColorImage (void) |
| Image & | channel (int num) |
| const Image & | channel (int num) const |
| void | read (char const *fname) |
| void | read (char const *fname, filetype ftype) |
| void | write (char const *fname, bool beautify=false) |
| void | write (char const *fname, filetype ftype, bool beautify=false) |
| Image * | averageImage (void) |
| virtual void | beautify (int yoffs=0, int xoffs=0, int ysize=0, int xsize=0) |
| ColorImage * | clone (void) const |
| virtual void | copy (ColorImage &img) |
| int | quality (void) const |
| void | quality (int quality) |
| ColorImage * | crop (int yoffs, int xoffs, int ysize, int xsize) const |
| virtual void | paste (int yoffs, int xoffs, ColorImage &img) |
| virtual void | shift (int yoffs, int xoffs) |
| void | fill (coeff *values, int fromY=0, int fromX=0, int toY=-1, int toX=-1) |
| void | fill (int *values, int fromY=0, int fromX=0, int toY=-1, int toX=-1) |
| virtual ColorImage * | fitInto (int rows, int cols, int *fill=NULL, int function=0) const |
| virtual ColorImage * | fitInto (int rows, int cols, bool mirrorExtend, int function=0) const |
| virtual ColorImage * | fitInto (int rows, int cols, ExtendFunc extend, int function=0) const |
| virtual ColorImage * | fitInto (int rows, int cols, ResizeFillFunc *fillFunc, int function=0) const |
| virtual ColorImage * | scale (double factor, int function=0) const |
| virtual ColorImage * | scale (double yFactor, double xFactor, int function=0) const |
Protected Member Functions | |
| void | init (Image **images=NULL, bool isReference=false, bool isMine=false) |
| virtual void | destroy (void) |
Private Attributes | |
| int | m_quality |
An image wrapper for bitmap images of three color components. Objects may import and export different bitmap formats, such as PPM. The color models can be changed (RGB or YUV).
Definition at line 24 of file ColorImage.hh.
| ColorImage::ColorImage | ( | int | colors = 3, |
| clrmodel | cmodel = cm_rgb, |
||
| Image ** | images = NULL, |
||
| bool | isReference = false, |
||
| bool | isMine = false |
||
| ) |
Constructor. Creates objects and sets actual start values.
| colors | the number of colors, and therefore the array's length |
| cmodel | the color model |
| images | an array of {colors} images to copy the channel data from |
| 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 |
| isMine | if true the incoming images will not be cloned, i.e. ownership is transferred to this color image |
| ColorImage::ColorImage | ( | int | rows, |
| int | cols, | ||
| int | colors = 3, |
||
| clrmodel | cmodel = cm_rgb |
||
| ) |
Constructor. Creates an image of a given size.
| rows | the number of image rows to create |
| cols | the number of image cols to create |
| colors | the number of colors |
| cmodel | the color model |
| virtual ColorImage::~ColorImage | ( | void | ) | [virtual] |
Destructor. Frees allocated objects.
| Image* ColorImage::averageImage | ( | void | ) |
Return a new greyscale image containing the three color channels' averages
| virtual void ColorImage::beautify | ( | int | yoffs = 0, |
| int | xoffs = 0, |
||
| int | ysize = 0, |
||
| int | xsize = 0 |
||
| ) | [virtual] |
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 {ysize} and {xsize} parameters should be set to nonzero values.
| ysize | the horizontal size of the region that should be handled separately |
| xsize | the vertical size of the region that should be handled separately |
| yoffs | the horizontal offset of the region that should be handled separately |
| xoffs | the vertical offset of the region that should be handled separately |
Implements ColorBuffer.
| Image& ColorImage::channel | ( | int | num | ) | [inline] |
Returns a reference to one of the color channels. {Don't change the dimensions of single channels unless you know what you're doing!}
| num | the number of the color channel |
Definition at line 64 of file ColorImage.hh.
| const Image& ColorImage::channel | ( | int | num | ) | const [inline] |
Returns a reference to one of the color channels. {Don't change the dimensions of single channels unless you know what you're doing!}
| num | the number of the color channel |
Definition at line 71 of file ColorImage.hh.
| ColorImage* ColorImage::clone | ( | void | ) | const |
Produce a copy of this image.
| virtual void ColorImage::copy | ( | ColorImage & | img | ) | [virtual] |
Copy all data from a source image.
| img | the source image |
| invalid_argument | if the two images' number of color channels do not match |
| ColorImage* ColorImage::crop | ( | int | yoffs, |
| int | xoffs, | ||
| int | ysize, | ||
| int | xsize | ||
| ) | const |
Returns a subimage.
| yoffs | the row where to start |
| xoffs | the col where to start |
| ysize | the vertical size |
| xsize | the horizontal size |
| virtual void ColorImage::destroy | ( | void | ) | [protected, virtual] |
Deletes allocated objects.
Reimplemented from ColorBuffer.
| void ColorImage::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
| values | an array of this->colors() entries containing the the new values one per channel for the selected positions (coeff values) |
| fromY | the first point's row |
| fromX | the first point's col |
| toY | the second point's row (-1 if lower image border) |
| toX | the second point's col (-1 if right image border) |
| void ColorImage::fill | ( | int * | values, |
| int | fromY = 0, |
||
| int | fromX = 0, |
||
| int | toY = -1, |
||
| int | toX = -1 |
||
| ) |
Fills an image (or regions of it) with a given value
| values | an array of this->colors() entries containing the the new values one per channel for the selected positions (int values) |
| fromY | the first point's row |
| fromX | the first point's col |
| toY | the second point's row (-1 if lower image border) |
| toX | the second point's col (-1 if right image border) |
| virtual ColorImage* ColorImage::fitInto | ( | int | rows, |
| int | cols, | ||
| int * | fill = NULL, |
||
| int | function = 0 |
||
| ) | const [virtual] |
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.
| invalid_argument | the factor is negative or the function argument is invalid |
| rows | the target number of rows |
| cols | the target number of columns |
| 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) |
| function | interpolation function (0: bilinear interpolation, 1: average, 2: nearest neighbour). |
| virtual ColorImage* ColorImage::fitInto | ( | int | rows, |
| int | cols, | ||
| bool | mirrorExtend, | ||
| int | function = 0 |
||
| ) | const [virtual] |
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.
| invalid_argument | the factor is negative or the function argument is invalid |
| rows | the target number of rows |
| cols | the target number of columns |
| 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) |
| function | interpolation function (0: bilinear interpolation, 1: average, 2: nearest neighbour). |
| virtual ColorImage* ColorImage::fitInto | ( | int | rows, |
| int | cols, | ||
| ExtendFunc | extend, | ||
| int | function = 0 |
||
| ) | const [virtual] |
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.
| invalid_argument | the factor is negative or the function argument is invalid |
| rows | the target number of rows |
| cols | the target number of columns |
| extend | the type of extension function used if the aspect ratio does not match (else the a smaller image size will be chosen if the aspect ratio does not match) |
| function | interpolation function (0: bilinear interpolation, 1: average, 2: nearest neighbour). |
| virtual ColorImage* ColorImage::fitInto | ( | int | rows, |
| int | cols, | ||
| ResizeFillFunc * | fillFunc, | ||
| int | function = 0 |
||
| ) | const [virtual] |
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.
| invalid_argument | the factor is negative or the function argument is invalid |
| rows | the target number of rows |
| cols | the target number of columns |
| 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) |
| function | interpolation function (0: bilinear interpolation, 1: average, 2: nearest neighbour). |
| void ColorImage::init | ( | Image ** | images = NULL, |
| bool | isReference = false, |
||
| bool | isMine = false |
||
| ) | [protected] |
Allocate objects and set standard values.
| images | an array of {colors} images to copy the channel data from |
| isReference | if true, only references to the images will be copied, and they will not be deleted at object destruction |
| isMine | if true, the ownership of the incoming images will be transferred to this color image |
| virtual void ColorImage::paste | ( | int | yoffs, |
| int | xoffs, | ||
| ColorImage & | img | ||
| ) | [virtual] |
Inserts a subimage.
| yoffs | the row where to start |
| xoffs | the col where to start |
| img | the image to insert |
| invalid_argument | if the two images' number of color channels do not match |
| int ColorImage::quality | ( | void | ) | const [inline] |
Return the current image quality factor.
Definition at line 152 of file ColorImage.hh.
| void ColorImage::quality | ( | int | quality | ) | [inline] |
Sets a new image quality factor.
Definition at line 156 of file ColorImage.hh.
References quality().
Referenced by quality().
| void ColorImage::read | ( | char const * | fname | ) |
Read the image. All steps independent of the file format will be performed, like testing for file readability etc.
| invalid_argument | invalid file format |
| ios_base::failure | a read error has occured [not supported by all libraries, so eventually {invalid_argument} instead] |
| void ColorImage::read | ( | char const * | fname, |
| filetype | ftype | ||
| ) |
Read an image. Reads an image from a file using the specified file type. Currently PGM, RAW and PFI are supported.
| invalid_argument | the file type is either not supported or could not be determined from the given file name |
| fname | the file name, if {NULL}, then {stdin} |
| ftype | the file type |
| virtual ColorImage* ColorImage::scale | ( | double | factor, |
| int | function = 0 |
||
| ) | const [virtual] |
Produce a scaled version of the image. The aspect ratio will remain the same.
| invalid_argument | the factor is negative or the function argument is invalid |
| factor | the scale factor (>= 0, 1 for no change) |
| function | interpolation function (0: bilinear interpolation, 1: average, 2: nearest neighbour). |
| virtual ColorImage* ColorImage::scale | ( | double | yFactor, |
| double | xFactor, | ||
| int | function = 0 |
||
| ) | const [virtual] |
Produce a scaled version of the image. The aspect ratio depends on the two scale factors
| invalid_argument | the factor is negative or the function argument is invalid |
| yFactor | the vertical scale factor (>= 0, 1 for no change) |
| xFactor | the horizontal scale factor (>= 0, 1 for no change) |
| function | interpolation function (0: bilinear interpolation, 1: average, 2: nearest neighbour). |
| virtual void ColorImage::shift | ( | int | yoffs, |
| int | xoffs | ||
| ) | [virtual] |
Shift an Image.
| yoffs | the rows to shift |
| xoffs | the cols to shift |
| void ColorImage::write | ( | char const * | fname, |
| bool | beautify = false |
||
| ) |
Write the image. All steps independent of the file format will be performed, like testing for file writeability etc.
| ios_base::failure | a read error has occured [not supported by all libraries, so eventually {invalid_argument} instead] |
| invalid_argument | the source image has a different number of colors than the target format allows |
| fname | the target file name |
| beautify | beautify images that have not had more analysis than synthesis steps? |
| void ColorImage::write | ( | char const * | fname, |
| filetype | ftype, | ||
| bool | beautify = false |
||
| ) |
Write an image (abstract). Writes an image to a file using the specified file type.
| ftype | the file type |
| fname | the file name, if {NULL}, then {stdout} |
| beautify | beautify images that have not had more analysis than synthesis steps? |
int ColorImage::m_quality [private] |
The image quality (if stored in lossy format like JPG)
Definition at line 309 of file ColorImage.hh.
1.7.6.1