| VRS - The Virtual Rendering System |
| version 3.3 |
#include <vrs/image/image.h>

Public Types | |
| enum | LayerSequence { L = 1, LA = 2, RGB = 3, RGBA = 4, R, G, B, A, I, BGR, BGRA, ABGR, INDEX, COMPRESSED } |
| enum | Layer { Red = 1, Green = 2, Blue = 4, Alpha = 8, Luminance = 16, Intensity = 32, Index = 64, All = 127 } |
| enum | DataType { U8 = 1, U16 = 2, U32 = 4 } |
| enum | MemoryLayout { Increasing = +1, Decreasing = -1 } |
Public Member Functions | |
| VRS_SERIALIZABLE_CLASS_ENUM (LayerSequence) | |
| Image (LayerSequence layerSequence=Image::RGB, int dataType=Image::U8) | |
| bool | operator== (const Image &other) const |
| LayerSequence | layerSequence () const |
| int | numberOfLayers () const |
| VRS_SERIALIZABLE_CLASS_ENUM (Layer) | |
| virtual int | hasLayers () const |
| virtual bool | hasLayers (int layers) const |
| virtual int | layerNumber (int layer) const |
| virtual Layer | layerType (int layerIndex) const |
| virtual int | width () const =0 |
| virtual int | height () const =0 |
| unsigned int | sizeX () const |
| unsigned int | sizeY () const |
| Return the width and height of the image in pixels. | |
| virtual void * | pixelComponents (int x, int y, int component=0) const =0 |
| ImageU8 * | pixelComponentsU8 (int x, int y, int component=0) const |
| ImageU16 * | pixelComponentsU16 (int x, int y, int component=0) const |
| ImageU32 * | pixelComponentsU32 (int x, int y, int component=0) const |
| virtual void * | lineComponents (int y) const |
| ImageU8 * | lineComponentsU8 (int y) const |
| ImageU16 * | lineComponentsU16 (int y) const |
| ImageU32 * | lineComponentsU32 (int y) const |
| Short form for pixelComponents*(0, y, 0). | |
| virtual Color | getColor (int x, int y) const |
| virtual void | setColor (int x, int y, const Color &col) |
| void | setRegionOfInterest (const Area ®ion=Area(0, 0,-1,-1)) |
| Area | getRegionOfInterest () const |
| void | setLayersOfInterest (int layers=Image::All) |
| void | addLayersOfInterest (int layers=Image::All) |
| void | removeLayersOfInterest (int layers=Image::All) |
| int | getLayersOfInterest () const |
| bool | areLayersOfInterest (int layers) const |
| virtual void | setValue (double value, Image *destImage=0) |
| virtual void | addValue (double value, Image *destImage=0) |
| virtual void | subValue (double value, Image *destImage=0) |
| virtual void | setScaledValue (double normalizedValue, Image *destImage=0) |
| virtual void | addScaledValue (double normalizedValue, Image *destImage=0) |
| virtual void | subScaledValue (double normalizedValue, Image *destImage=0) |
| virtual void | multValue (double value, Image *destImage=0) |
| virtual void | squareValue (Image *destImage=0) |
| virtual void | gammaValue (double gamma=2.2, Image *destImage=0) |
| virtual void | andValue (double value, Image *destImage=0) |
| virtual void | orValue (double value, Image *destImage=0) |
| virtual void | xorValue (double value, Image *destImage=0) |
| virtual void | notValue (double value, Image *destImage=0) |
| virtual void | lshiftValue (double shifts, Image *destImage=0) |
| virtual void | rshiftValue (double shifts, Image *destImage=0) |
| Manipulate the pixel components by applying logical operations. | |
| virtual void | filter (Callback2< void *, void * > *filterFunction, Image *destImage=0) |
| virtual void | colorFilter (const Color &refColor, const Color &substColor, double tolerance=0.0, Image *destImage=0) |
| virtual void | alphaFilter (const Color &refColor, double alpha, double tolerance=0.0, Image *destImage=0) |
| virtual void | blur (int sizeX, int sizeY, Image *destImage=0) |
| virtual void | mosaic (int sizeX, int sizeY, Image *destImage=0) |
| virtual void | flip (bool flipX, bool flipY, Image *destImage=0) |
| virtual void | convolution (const ImageConvolutionKernel *kernel, Image *destImage=0) |
| virtual void | addImage (Image *image2, Image *dest=0) |
| virtual void | subImage (Image *image2, Image *dest=0) |
| virtual void | multImage (Image *image2, Image *dest=0) |
| virtual void | copy (Image *destImage, bool scale=true, bool ignoreROIandLOI=false) |
| virtual void | copyLayer (int srcLayer, Image *destImage, int destLayer, bool scale=true, bool ignoreROI=false) |
| virtual void | exchange (Image *destImage, bool scale=true, bool ignoreROIandLOI=false) |
| virtual void | greyScale (Image *destImage=0, bool scale=true, bool ignoreROIandLOI=false) |
| virtual Image * | copyToPow2 () |
| virtual SO< Iterator< SO < Image > > > | createMipmapPyramid () |
| Create the mipmap pyramid of this image, i.e. returns an iterator over images, where each has half size of predessor. Last image's size is 1x1. | |
| void | changeLayerSequence (LayerSequence newLayerSequence, bool forceChange=false) |
| VRS_SERIALIZABLE_CLASS_ENUM (DataType) | |
| int | dataType () const |
| VRS_SERIALIZABLE_CLASS_ENUM (MemoryLayout) | |
| virtual MemoryLayout | memoryLayout () const |
| virtual int | alignment () const |
| virtual int | padding () const |
| Returns the number of unused bytes at the end of each line. | |
| virtual int | bitsPerPixel () const |
| Returns the number of bits used for one pixel. | |
| Iterator2D< Color > * | newIterator2D () const |
| Iterator2D< float > * | newIterator2D (int layer, bool normalize=true, float scale=1.0, float bias=0.0) const |
| virtual SO< Image > | uncompressed (bool storeReference=false) const |
| If the image is an CompressedImage the decompressed image is returned here. | |
| VRS_SERIALIZABLE_ABSTRACT_CLASS (Image) | |
| VRS_TYPEINFO (Image, SharedObj) | |
| enum VRS::Image::Layer |
| enum VRS::Image::DataType |
| VRS::Image::Image | ( | LayerSequence | layerSequence = Image::RGB, |
|
| int | dataType = Image::U8 | |||
| ) |
The layer sequence and the data type of the pixels must be specified. By default, all layers are of interest except the alpha layer.
| VRS::Image::VRS_SERIALIZABLE_CLASS_ENUM | ( | LayerSequence | ) |
| bool VRS::Image::operator== | ( | const Image & | other | ) | const |
| LayerSequence VRS::Image::layerSequence | ( | ) | const |
| int VRS::Image::numberOfLayers | ( | ) | const |
Returns the sequence of the image layers and their meaning with respect to the image data. 'numberOfLayers' returns the number of layers. A compressed image has no accessible layer, that is, the number of layers is zero in that case.
| VRS::Image::VRS_SERIALIZABLE_CLASS_ENUM | ( | Layer | ) |
| virtual int VRS::Image::hasLayers | ( | ) | const [virtual] |
| virtual bool VRS::Image::hasLayers | ( | int | layers | ) | const [virtual] |
| virtual int VRS::Image::layerNumber | ( | int | layer | ) | const [virtual] |
| virtual Layer VRS::Image::layerType | ( | int | layerIndex | ) | const [virtual] |
'hasLayers' without arguments returns all existing layers. 'hasLayers' with argument checks if all 'layers' exist. if combinations of layers (e.g. Red|Alpha) are given, it returns whether all these layers exist. 'layerNumber' returns the rang of 'layer' in the layer sequence and returns -1 if 'layer' does not exist. You can use the macro IMAGE_FOR_EACH_LAYER(layer) to iterator over all layers.
| virtual int VRS::Image::width | ( | ) | const [pure virtual] |
Implemented in VRS::AVIVideo, VRS::CompressedImage, VRS::FileImage, VRS::GIFVideo, VRS::MemoryImage, VRS::PaletteFileImage, VRS::PaletteImage, and VRS::SubImage.
| virtual int VRS::Image::height | ( | ) | const [pure virtual] |
Implemented in VRS::AVIVideo, VRS::CompressedImage, VRS::FileImage, VRS::GIFVideo, VRS::MemoryImage, VRS::PaletteFileImage, VRS::PaletteImage, and VRS::SubImage.
| unsigned int VRS::Image::sizeX | ( | ) | const [inline] |
| unsigned int VRS::Image::sizeY | ( | ) | const [inline] |
Return the width and height of the image in pixels.
| virtual void* VRS::Image::pixelComponents | ( | int | x, | |
| int | y, | |||
| int | component = 0 | |||
| ) | const [pure virtual] |
Implemented in VRS::AVIVideo, VRS::CompressedImage, VRS::FileImage, VRS::GIFVideo, VRS::MemoryImage, VRS::PaletteFileImage, VRS::PaletteImage, VRS::SubImage, and VRS::Video.
| ImageU8* VRS::Image::pixelComponentsU8 | ( | int | x, | |
| int | y, | |||
| int | component = 0 | |||
| ) | const |
| ImageU16* VRS::Image::pixelComponentsU16 | ( | int | x, | |
| int | y, | |||
| int | component = 0 | |||
| ) | const |
| ImageU32* VRS::Image::pixelComponentsU32 | ( | int | x, | |
| int | y, | |||
| int | component = 0 | |||
| ) | const |
This method provides direct access to the image components stored for the pixel (x, y) starting at 'component'.
| virtual void* VRS::Image::lineComponents | ( | int | y | ) | const [virtual] |
Reimplemented in VRS::FileImage, VRS::MemoryImage, VRS::PaletteFileImage, VRS::PaletteImage, and VRS::SubImage.
| ImageU8* VRS::Image::lineComponentsU8 | ( | int | y | ) | const |
| ImageU16* VRS::Image::lineComponentsU16 | ( | int | y | ) | const |
| ImageU32* VRS::Image::lineComponentsU32 | ( | int | y | ) | const |
Short form for pixelComponents*(0, y, 0).
| virtual Color VRS::Image::getColor | ( | int | x, | |
| int | y | |||
| ) | const [virtual] |
| virtual void VRS::Image::setColor | ( | int | x, | |
| int | y, | |||
| const Color & | col | |||
| ) | [virtual] |
According to the available layers, for each pixel the image stores one or more coefficients. If the color is set for a pixel, the red, green, blue, and alpha coefficients of the color are copied to the red, green, blue, and alpha layer of the pixel. If a layer is not available, e.g., if there is no alpha layer, the corresponding coefficient contained in the color is ignored. If the image consists of a luminance or intensity layer, the color is converted to a luminance value (Color::luminance). The color coefficients are in the range [0,1]. The color domain is scaled to fit the domain of the pixel data type. For example, in the case of Image::U8, the range [0,1] is scaled to [0,255].
| Area VRS::Image::getRegionOfInterest | ( | ) | const |
The region of interest specifies the image area actually manipulated by subsequent image operations. All pixels outside that area are not affected by image operations. A width of -1 indicates the maximal width. A height of -1 indicates the maximal height.
| void VRS::Image::setLayersOfInterest | ( | int | layers = Image::All |
) |
| void VRS::Image::addLayersOfInterest | ( | int | layers = Image::All |
) |
| void VRS::Image::removeLayersOfInterest | ( | int | layers = Image::All |
) |
| int VRS::Image::getLayersOfInterest | ( | ) | const |
| bool VRS::Image::areLayersOfInterest | ( | int | layers | ) | const |
The layers of interest specify the image layers actually manipulated by image operations. All layers that are set to 'false' are not affected by image operations.
| virtual void VRS::Image::setValue | ( | double | value, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
| virtual void VRS::Image::addValue | ( | double | value, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
| virtual void VRS::Image::subValue | ( | double | value, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
Manipulate the pixel components by setting, adding, subtracting a value to the pixels of the current region of interest.
| virtual void VRS::Image::setScaledValue | ( | double | normalizedValue, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
| virtual void VRS::Image::addScaledValue | ( | double | normalizedValue, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
| virtual void VRS::Image::subScaledValue | ( | double | normalizedValue, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
Manipulate the pixel components by setting, adding, subtracting a normalized value (0 <= normalizedValue <= 1) to the normalized pixels of the current region of interest.
| virtual void VRS::Image::multValue | ( | double | value, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
| virtual void VRS::Image::squareValue | ( | Image * | destImage = 0 |
) | [virtual] |
| virtual void VRS::Image::gammaValue | ( | double | gamma = 2.2, |
|
| Image * | destImage = 0 | |||
| ) | [virtual] |
Manipulate the pixel components by multiplying, squaring etc. a value to the pixels of the current region of interest.
| virtual void VRS::Image::andValue | ( | double | value, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
| virtual void VRS::Image::orValue | ( | double | value, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
| virtual void VRS::Image::xorValue | ( | double | value, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
| virtual void VRS::Image::notValue | ( | double | value, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
| virtual void VRS::Image::lshiftValue | ( | double | shifts, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
| virtual void VRS::Image::rshiftValue | ( | double | shifts, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
Manipulate the pixel components by applying logical operations.
| virtual void VRS::Image::filter | ( | Callback2< void *, void * > * | filterFunction, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
This filter method represents a generic per-pixel operation applications can use to implement their own operations. The filter applies the given callback to all pixel in the current region of interest. The layers of interest are ignored, i.e., the filter callback has access to to all layers.
| virtual void VRS::Image::colorFilter | ( | const Color & | refColor, | |
| const Color & | substColor, | |||
| double | tolerance = 0.0, |
|||
| Image * | destImage = 0 | |||
| ) | [virtual] |
The color filter replaces the color of those pixels in the image which have the reference color (within the given tolerance) by the substitution color. The filter is applied within the current region of interest. Only the current layers of interest are modified. For a luminance image, the luminance value of the color is used as reference value.
| virtual void VRS::Image::alphaFilter | ( | const Color & | refColor, | |
| double | alpha, | |||
| double | tolerance = 0.0, |
|||
| Image * | destImage = 0 | |||
| ) | [virtual] |
The alpha filter replaces the alpha value of those pixels which have the reference color (within the given tolerance). The operation can only be applied to images with an alpha layer. In the case of luminance images, the luminance value of the reference color is used as reference value.
| virtual void VRS::Image::blur | ( | int | sizeX, | |
| int | sizeY, | |||
| Image * | destImage = 0 | |||
| ) | [virtual] |
| virtual void VRS::Image::mosaic | ( | int | sizeX, | |
| int | sizeY, | |||
| Image * | destImage = 0 | |||
| ) | [virtual] |
| virtual void VRS::Image::flip | ( | bool | flipX, | |
| bool | flipY, | |||
| Image * | destImage = 0 | |||
| ) | [virtual] |
The blur, mosaic, and flip operations are built-in region operations for images. Blur smoothes the images, averaging pixel values inside sizeX x sizeY large blocks. Mosaic tessellates the image by computing and filling the average color inside sizeX x sizeY large blocks. Flip reverses the pixel values horizontally and/or vertically.
| virtual void VRS::Image::convolution | ( | const ImageConvolutionKernel * | kernel, | |
| Image * | destImage = 0 | |||
| ) | [virtual] |
Applies a convolution operation specified by the convolution kernel to the image.
| virtual void VRS::Image::copy | ( | Image * | destImage, | |
| bool | scale = true, |
|||
| bool | ignoreROIandLOI = false | |||
| ) | [virtual] |
| virtual void VRS::Image::copyLayer | ( | int | srcLayer, | |
| Image * | destImage, | |||
| int | destLayer, | |||
| bool | scale = true, |
|||
| bool | ignoreROI = false | |||
| ) | [virtual] |
| virtual void VRS::Image::exchange | ( | Image * | destImage, | |
| bool | scale = true, |
|||
| bool | ignoreROIandLOI = false | |||
| ) | [virtual] |
| virtual void VRS::Image::greyScale | ( | Image * | destImage = 0, |
|
| bool | scale = true, |
|||
| bool | ignoreROIandLOI = false | |||
| ) | [virtual] |
| virtual Image* VRS::Image::copyToPow2 | ( | ) | [virtual] |
Create the mipmap pyramid of this image, i.e. returns an iterator over images, where each has half size of predessor. Last image's size is 1x1.
| void VRS::Image::changeLayerSequence | ( | LayerSequence | newLayerSequence, | |
| bool | forceChange = false | |||
| ) |
'changeLayerSequence' replaces the old layer sequence with newLayerSequence. The number of layers must be the same, if 'forceChange' is not true.
| VRS::Image::VRS_SERIALIZABLE_CLASS_ENUM | ( | DataType | ) |
| int VRS::Image::dataType | ( | ) | const |
Returns the data type of a pixel component. A pixel is composed of N components, whereby N is the number of layers. For each pixel of an image, the data type is the same. Typically, U8, that is, unsigned char, is used for common images.
| VRS::Image::VRS_SERIALIZABLE_CLASS_ENUM | ( | MemoryLayout | ) |
| virtual MemoryLayout VRS::Image::memoryLayout | ( | ) | const [virtual] |
Returns the the internal memory layout of the image. Increasing: lineComponents(i + 1) > lineComponents(i) Decreasing: lineComponents(i + 1) < lineComponents(i)
Reimplemented in VRS::CompressedImage, and VRS::DecoratedImage.
| virtual int VRS::Image::alignment | ( | ) | const [virtual] |
Returns the alignment of one scan line of the image. An alignment of 1 means no alignment (can be 1, 2, 4 or 8).
Reimplemented in VRS::CompressedImage, and VRS::DecoratedImage.
| virtual int VRS::Image::padding | ( | ) | const [virtual] |
Returns the number of unused bytes at the end of each line.
Reimplemented in VRS::CompressedImage, and VRS::DecoratedImage.
| virtual int VRS::Image::bitsPerPixel | ( | ) | const [virtual] |
Returns the number of bits used for one pixel.
Reimplemented in VRS::CompressedImage, and VRS::DecoratedImage.
| Iterator2D<Color>* VRS::Image::newIterator2D | ( | ) | const |
Returns a 2-dim. iterator with color values of this image.
| Iterator2D<float>* VRS::Image::newIterator2D | ( | int | layer, | |
| bool | normalize = true, |
|||
| float | scale = 1.0, |
|||
| float | bias = 0.0 | |||
| ) | const |
Returns a 2-dim. iterator for the values of the given layer. If "normalize" is true the values are normalized to the range [0, 1]; if "normalize" is false the values are returned as they are stored (e.g. in the range [0, 255] for a data type of U8, range [0, 65535] for a data type of U16, range [0, UINT_MAX] for a data type of U32. The returned values can be scaled by the given "scale" factor and biased by the given "bias" value.
If the image is an CompressedImage the decompressed image is returned here.
If the image is not compressed, it will be directly returned.
Reimplemented in VRS::CompressedImage, and VRS::SubImage.
| VRS::Image::VRS_SERIALIZABLE_ABSTRACT_CLASS | ( | Image | ) |