[ VIGRA Homepage | Class Index | Function Index | File Index | Main Page ]
![]() |
Functors to Transform Images | ![]() |
---|
Classes | |
class | BrightnessContrastFunctor |
Adjust brightness and contrast of an image. More... | |
class | Threshold |
Threshold an image. More... | |
Functions | |
template<class Multiplier, class DestValueType> LinearIntensityTransform< DestValueType, Multiplier > | linearIntensityTransform (Multiplier scale, DestValueType offset) |
Apply a linear transform to the source pixel values. | |
template<class SrcValueType, class DestValueType> LinearIntensityTransform< DestValueType, typename NumericTraits< DestValueType >::RealPromote > | linearRangeMapping (SrcValueType src_min, SrcValueType src_max, DestValueType dest_min, DestValueType dest_max) |
Map a source intensity range linearly to a destination range. |
Detailed Description |
LinearIntensityTransform<DestValueType, Multiplier> linearIntensityTransform (...) |
Apply a linear transform to the source pixel values.
Factory function for a functor that linearly transforms the source pixel values. The functor applies the transform ' If you leave out the second parameter / offset, you will get an optimized version of the functor which only scales by the given factor, however you have to make the template parameter (pixel type) explicit. Declaration:
namespace vigra { template <class Multiplier, class DestValueType> LinearIntensityTransform<DestValueType, Multiplier> linearIntensityTransform(Multiplier scale, DestValueType offset); template <class DestValueType, class Multiplier> ScalarIntensityTransform<DestValueType, Multiplier> linearIntensityTransform(Multiplier scale); } Usage:
#include "vigra/transformimage.hxx"
vigra::IImage src(width, height); vigra::BImage dest(width, height); ... vigra::FindMinMax<IImage::PixelType> minmax; // functor to find range vigra::inspectImage(srcImageRange(src), minmax); // find original range // transform to range 0...255 vigra::transformImage(srcImageRange(src), destImage(dest), linearIntensityTransform( 255.0 / (minmax.max - minmax.min), // scaling - minmax.min)); // offset The one-parameter version can be used like this:
// scale from 0..255 to 0..1.0 FImage dest(src.size()); vigra::transformImage(srcImageRange(src), destImage(dest), linearIntensityTransform<float>(1.0 / 255)); Required Interface: The source and destination value types must be models of LinearSpace in both cases. |
LinearIntensityTransform<DestValueType, typename NumericTraits<DestValueType>::RealPromote> linearRangeMapping (...) |
Map a source intensity range linearly to a destination range.
Factory function for a functor that linearly transforms the source pixel values. The functor applies the transform ' Declaration:
namespace vigra { template <class SrcValueType, class DestValueType> LinearIntensityTransform<DestValueType, typename NumericTraits<DestValueType>::RealPromote> linearRangeMapping(SrcValueType src_min, SrcValueType src_max, DestValueType dest_min, DestValueType dest_max ); } Usage:
#include "vigra/transformimage.hxx"
vigra::IImage src(width, height); vigra::BImage dest(width, height); ... vigra::FindMinMax<IImage::PixelType> minmax; // functor to find range vigra::inspectImage(srcImageRange(src), minmax); // find original range // transform to range 0...255 vigra::transformImage(srcImageRange(src), destImage(dest), linearRangeTransform( minmax.min, minmax.max, // src range (unsigned char)0, (unsigned char)255) // dest range ); Required Interface: The source and destination value types must be models of LinearSpace in both cases. |
© Ullrich Köthe (koethe@informatik.uni-hamburg.de) |
html generated using doxygen and Python
|