[ VIGRA Homepage | Class Index | Function Index | File Index | Main Page ]
![]() |
BrightnessContrastFunctor Class Template Reference | ![]() |
---|
Adjust brightness and contrast of an image. More...
#include "vigra/transformimage.hxx"
Public Types | |
typedef PixelType | argument_type |
typedef PixelType | result_type |
typedef PixelType | value_type |
Public Methods | |
BrightnessContrastFunctor (promote_type brightness, promote_type contrast, argument_type const &min, argument_type const &max) | |
result_type | operator() (argument_type const &v) const |
Detailed Description |
This functor applies a gamma correction to each pixel in order to modify the brightness of the image. To the result of the gamma correction, another transform is applied that modifies the contrast. The brightness and contrast parameters must be positive. Values greater than 1 will increase image brightness and contrast, values smaller than 1 decrease them. A value = 1 will have no effect. For RGBValue's, the transforms are applied component-wise. The pixel values are assumed to lie between the given minimum and maximum values. In case of RGB, this is again understood component-wise. In case of unsigned char
, min and max default to 0 and 255 respectively. Precisely, the following transform is applied to each PixelValue:
If the PixelType
is unsigned char
, a look-up-table is used for faster computation.
Usage:
#include "vigra/transformimage.hxx"
Namespace: vigra
vigra::BImage bimage(width, height); double brightness, contrast; ... vigra::transformImage(srcImageRange(bimage), destImage(bimage), vigra::BrightnessContrastFunctor<unsigned char>(brightness, contrast)); vigra::FImage fimage(width, height); ... vigra::FindMinmax<float> minmax; vigra::inspectImage(srcImageRange(fimage), minmax); vigra::transformImage(srcImageRange(fimage), destImage(fimage), vigra::BrightnessContrastFunctor<float>(brightness, contrast, minmax.min, minmax.max));
Required Interface:
Scalar types: must be a linear algebra (+, - *, NumericTraits), strict weakly ordered (<), and pow()
must be defined.
RGB values: the component type must meet the above requirements.
|
the functor's argument type |
|
the functor's result type |
|
|
|
Init functor for argument range |
|
Calculate modified gray or color value |
© Ullrich Köthe (koethe@informatik.uni-hamburg.de) |
html generated using doxygen and Python
|