last update 20 Sep 2009 |
#include <cvrHueLUT.h>
Public Member Functions | |
hueLUT () | |
float | operator() (const int r, const int g) const |
virtual const std::string & | name () const |
virtual hueLUT * | clone () const |
virtual hueLUT * | newInstance () const |
Protected Types | |
typedef const float * | cfloatptr_ |
Static Protected Member Functions | |
static void | constructHueLUT () |
Static Protected Attributes | |
static const cfloatptr_ * | hueLUT_ |
The hue is defined in terms of the RGB components and rgb chromaticities as
where for the last equation it was used the fact that .
Note: This class normalizes the hue to be in the range [0,1] which is more practical for the CVR-Lib than the typical 0..360 degrees definition.
The LUT uses the fact that r+g+b=255 and thus only takes r and g as inputs, where r,g, and b are the chromaticity values obtained by normalization as r=R/(R+G+B), g=G/(R+G+B). These values need to be multiplied by 511, which is the last index the LUT takes. Note that r+g<512, and r,g >= 0
As a mono-state class, only one instance of the LUT array will be created.
typedef const float* cvr::hueLUT::cfloatptr_ [protected] |
Type required to create the LUT as a const structure.
cvr::hueLUT::hueLUT | ( | ) |
Construct the class Here, the LUT will be build just once (if not already done).
The first time you construct this class, it will take about 0.15 seconds to build the LUT.
virtual hueLUT* cvr::hueLUT::clone | ( | ) | const [virtual] |
static void cvr::hueLUT::constructHueLUT | ( | ) | [static, protected] |
Construct a hue LUT.
It assumes that r,g>=0 and r+g<512. The 0.5MB memory required should not be a problem in modern PCs anymore!.
virtual const std::string& cvr::hueLUT::name | ( | ) | const [virtual] |
virtual hueLUT* cvr::hueLUT::newInstance | ( | ) | const [virtual] |
float cvr::hueLUT::operator() | ( | const int | r, | |
const int | g | |||
) | const [inline] |
return the hue for (r,g).
r,g >=0 and r+g<512
r | red component | |
g | green component |
References hueLUT_.
const cfloatptr_* cvr::hueLUT::hueLUT_ [static, protected] |