[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
|
GammaFunctor [Functors to Transform Images] |
![]() |
Perform gamma correction of an image. More...
#include <vigra/transformimage.hxx>
Public Types | |
| typedef PixelType | argument_type |
| typedef PixelType | result_type |
| typedef PixelType | value_type |
Public Member Functions | |
| GammaFunctor (double gamma, argument_type const &min, argument_type const &max) | |
| result_type | operator() (argument_type const &v) const |
This functor applies a gamma correction to each pixel in order to modify the brightness of the image. Gamma values smaller than 1 will increase image brightness, whereas values greater than 1 decrease it. A value of gamma = 1 will have no effect. (See also BrightnessContrastFunctor, which additionally changes the contrast.)
For RGBValue's, the transforms are applied component-wise. For ease of use, 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.
Traits defined:
FunctorTraits::isUnaryFunctor is true (VigraTrueType)
Usage:
#include <vigra/transformimage.hxx>
Namespace: vigra
vigra::BImage bimage(width, height); double gamma; ... vigra::transformImage(srcImageRange(bimage), destImage(bimage), vigra::GammaFunctor<unsigned char>(gamma)); vigra::FImage fimage(width, height); ... vigra::FindMinmax<float> minmax; vigra::inspectImage(srcImageRange(fimage), minmax); vigra::transformImage(srcImageRange(fimage), destImage(fimage), vigra::GammaFunctor<float>(gamma, 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.
| typedef PixelType argument_type |
the functor's argument type
| typedef PixelType result_type |
the functor's result type
| typedef PixelType value_type |
| GammaFunctor | ( | double | gamma, | |
| argument_type const & | min, | |||
| argument_type const & | max | |||
| ) |
Init functor for argument range [min, max]. gamma values < 1 will increase brightness, > 1 will decrease it (gamma == 1 means no change).
| result_type operator() | ( | argument_type const & | v | ) | const |
Calculate modified gray or color value
|
© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) |
html generated using doxygen and Python
|