[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

RGB2sRGBFunctor< From, To > Class Template Reference

Convert linear (raw) RGB into standardized sRGB. More...

#include <vigra/colorconversions.hxx>

Public Types

typedef TinyVector< From, 3 > argument_type
 
typedef NumericTraits< To >::RealPromote component_type
 
typedef TinyVector< To, 3 > result_type
 
typedef TinyVector< To, 3 > value_type
 

Public Member Functions

template<class V>
result_type operator() (V const &rgb) const
 
 RGB2sRGBFunctor ()
 
 RGB2sRGBFunctor (component_type max)
 

Detailed Description

template<class From, class To = From>
class vigra::RGB2sRGBFunctor< From, To >

Convert linear (raw) RGB into standardized sRGB.

#include <vigra/colorconversions.hxx>
Namespace: vigra

The sRGB color space is a slight improvement over the R'G'B' space. It is now a widely accepted international standard (IEC 61966-2.1) which is used by most consumer products (digital cameras, printers, and screens). The functor realizes the transformation

\[    C_{sRGB} = \left\{ \begin{array}{ll}
    12.92\,C_{RGB} & \textrm{ if }\frac{C_{RGB}}{C_{max}} \le 0.0031308 \\
    C_{max}\left( 1.055 \left(\frac{C_{RGB}}{C_{max}}\right)^{1/2.4}-0.055\right) & \textrm{ otherwise}
    \end{array}  \right.
\]

where C is any of the primaries R, G, and B. By default, $ C_{max} = 255 $ (this default can be overridden in the constructor). If both source and target color components are stored as unsigned char, a look-up-table will be used to speed up the transformation.

Traits defined:

FunctorTraits::isUnaryFunctor is true (VigraTrueType)

Member Typedef Documentation

◆ argument_type

template<class From, class To = From>
typedef TinyVector<From, 3> argument_type

the functor's argument type

◆ result_type

template<class From, class To = From>
typedef TinyVector<To, 3> result_type

the functor's result type

◆ value_type

template<class From, class To = From>
typedef TinyVector<To, 3> value_type

◆ component_type

template<class From, class To = From>
typedef NumericTraits<To>::RealPromote component_type

the result component's promote type

Constructor & Destructor Documentation

◆ RGB2sRGBFunctor() [1/2]

template<class From, class To = From>
RGB2sRGBFunctor ( )

Default constructor. The maximum value for each RGB component defaults to 255

◆ RGB2sRGBFunctor() [2/2]

template<class From, class To = From>
RGB2sRGBFunctor ( component_type max)

constructor

  • max - the maximum value for each RGB component

Member Function Documentation

◆ operator()()

template<class From, class To = From>
template<class V>
result_type operator() ( V const & rgb) const

apply the transformation


The documentation for this class was generated from the following file:

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.12.2 (Mon Apr 14 2025)