gml_TColor_LRG Class Template Reference

#include <gml_LRGColor.h>

Collaboration diagram for gml_TColor_LRG:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<typename Channel, typename KSize>
class gml_TColor_LRG< Channel, KSize >

A union type used to represent LRG-color pixels. LRG stands for Luminance, Normalized Red, Normalized Green colorspace.

The channels' storage type is specified as template parameter Channel. The second template parameter KSize specifies an integer type large enough to hold all computations.

Bug:
The following should be true, but for now we assume that: presChannelMax == 1 << sChannelBits in Convert(). This of course leads to some rounding errors, max 4/255.
Note that the full range of data that a channel can represent isn't used: for instance L values range from 0 to tt2 ** (sChannelBits() - 1). This is done to accelerate some computation, e.g. replacing divisions by sChannelMax() by bit-shifting operations.

Note:
Depending on the machine, this code is 10 to 20 times faster than OpenCV's version, which uses euclidian divisions extensively. We use a small (3k) lookup table and lots of bit-shifting.


Public Member Functions

 gml_TColor_LRG (const UInt8 r, const UInt8 g, const UInt8 b)
 Convert a 24-bit RGB triplet into LRG and fill in the object.
 gml_TColor_LRG (const void *const ptr)
 Fill the structure from data in memory.
 gml_TColor_LRG ()
 Leave structure `as is'.
void Print ()
 Dump a representation of the pixel to stdout: channels in hex and in 8-bit per channel hex format.
void Store (void *const ptr)
 Place the structure's data in memory.
void Convert (UInt8 &r, UInt8 &g, UInt8 &b)
 Convert the LRG data in this object to a 24 bit RGB triplet.
UInt16 Distance (const gml_TColor_LRG< Channel, KSize > other)
 Compute the 16-bit distance to another LRG pixel. Depending on __GML_LRG_USE_EUCLIDIAN_DISTANCE, the euclidian distance in the (Cr,Cg) plane is used, or the city block distance.

Static Public Member Functions

static UInt8 sChannelBits ()
 bits per channel
static KSize sChannelMax ()
 max channel value

Public Attributes

struct {
   Channel   L
 < structure for transparent channel access luminance channel
   Channel   R
 red chrominance channel
   Channel   G
 green chrominance channel
GML_PACKED

Member Function Documentation

void Print (  )  [inline]

Dump a representation of the pixel to stdout: channels in hex and in 8-bit per channel hex format.

Warning:
no newline appended !

Reimplemented in gml_TColor_LRG_FFF.

void Convert ( UInt8 r,
UInt8 g,
UInt8 b 
) [inline]

Convert the LRG data in this object to a 24 bit RGB triplet.

Todo:
replace the ?: selector with Select()

Reimplemented in gml_TColor_LRG_FFF.


The documentation for this class was generated from the following file:
Generated on Tue Jun 12 14:03:28 2007 for gml by Doxygen 1.5.2.