A templated pixel type class, where the channel type and number of channels are arguments.
Supports the defined channel types and channel counts of 1, 3, and 4. It can convert between any one type of pixel and any other directly, and provides constructors to achieve this. It also supports swapping the r and b channels and converting to inverse luminance. The channel types handle converting between each other, while the pixel types handle converting between each other.
#include <image.h>
Public Member Functions |
|
PixelType< ChanType, NumChans > & | swapRB () |
Swap the red and blue channels -- converts
RGBA to BGRA and back. |
|
PixelType (const PixelType< uInt8Channel, 4 > &p) | |
conversion constructor |
|
PixelType (const PixelType< uInt8Channel, 3 > &p) | |
conversion constructor |
|
PixelType (const PixelType< uInt8Channel, 1 > &p) | |
conversion constructor |
|
PixelType (const PixelType< uInt16Channel, 4 > &p) | |
conversion constructor |
|
PixelType (const PixelType< uInt16Channel, 3 > &p) | |
conversion constructor |
|
PixelType (const PixelType< uInt16Channel, 1 > &p) | |
conversion constructor |
|
PixelType (const PixelType< float16Channel, 4 > &p) | |
conversion constructor |
|
PixelType (const PixelType< float16Channel, 3 > &p) | |
conversion constructor |
|
PixelType (const PixelType< float16Channel, 1 > &p) | |
conversion constructor |
|
PixelType (const PixelType< float32Channel, 4 > &p) | |
conversion constructor |
|
PixelType (const PixelType< float32Channel, 3 > &p) | |
conversion constructor |
|
PixelType (const PixelType< float32Channel, 1 > &p) | |
conversion constructor |
|
void | SetLuminance (const PixelType< uInt8Channel, 4 > &p) |
RGBA = Luminance of input. |
|
void | SetLuminance (const PixelType< uInt8Channel, 3 > &p) |
RGBA = Luminance of input. |
|
void | SetLuminance (const PixelType< uInt16Channel, 4 > &p) |
RGBA = Luminance of input. |
|
void | SetLuminance (const PixelType< uInt16Channel, 3 > &p) |
RGBA = Luminance of input. |
|
void | SetLuminance (const PixelType< float16Channel, 4 > &p) |
RGBA = Luminance of input. |
|
void | SetLuminance (const PixelType< float16Channel, 3 > &p) |
RGBA = Luminance of input. |
|
void | SetLuminance (const PixelType< float32Channel, 4 > &p) |
RGBA = Luminance of input. |
|
void | SetLuminance (const PixelType< float32Channel, 3 > &p) |
RGBA = Luminance of input. |
|
void | SetLuminance (const PixelType< float32Channel, 1 > &p) |
RGBA = Luminance of input. |
|
void | SetLuminance (const PixelType< float16Channel, 1 > &p) |
RGBA = Luminance of input. |
|
void | SetLuminance (const PixelType< uInt16Channel, 1 > &p) |
RGBA = Luminance of input. |
|
void | SetLuminance (const PixelType< uInt8Channel, 1 > &p) |
RGBA = Luminance of input. |
|
void | SetInvLuminance (const PixelType< uInt8Channel, 4 > &p) |
RGBA = 1 - Luminance of input. |
|
void | SetInvLuminance (const PixelType< uInt8Channel, 3 > &p) |
RGBA = 1 - Luminance of input. |
|
void | SetInvLuminance (const PixelType< uInt16Channel, 4 > &p) |
RGBA = 1 - Luminance of input. |
|
void | SetInvLuminance (const PixelType< uInt16Channel, 3 > &p) |
RGBA = 1 - Luminance of input. |
|
void | SetInvLuminance (const PixelType< float16Channel, 4 > &p) |
RGBA = 1 - Luminance of input. |
|
void | SetInvLuminance (const PixelType< float16Channel, 3 > &p) |
RGBA = 1 - Luminance of input. |
|
void | SetInvLuminance (const PixelType< float32Channel, 4 > &p) |
RGBA = 1 - Luminance of input. |
|
void | SetInvLuminance (const PixelType< float32Channel, 3 > &p) |
RGBA = 1 - Luminance of input. |
|
void | SetInvLuminance (const PixelType< float32Channel, 1 > &p) |
RGBA = 1 - Luminance of input. |
|
void | SetInvLuminance (const PixelType< float16Channel, 1 > &p) |
RGBA = 1 - Luminance of input. |
|
void | SetInvLuminance (const PixelType< uInt16Channel, 1 > &p) |
RGBA = 1 - Luminance of input. |
|
void | SetInvLuminance (const PixelType< uInt8Channel, 1 > &p) |
RGBA = 1 - Luminance of input. |
|
Friends |
|
class | PixelType< uInt8Channel, 1 > |
class | PixelType< uInt8Channel, 3 > |
class | PixelType< uInt8Channel, 4 > |
class | PixelType< uInt16Channel, 1 > |
class | PixelType< uInt16Channel, 3 > |
class | PixelType< uInt16Channel, 4 > |
class | PixelType< float16Channel, 1 > |
class | PixelType< float16Channel, 3 > |
class | PixelType< float16Channel, 4 > |
class | PixelType< float32Channel, 1 > |
class | PixelType< float32Channel, 3 > |
class | PixelType< float32Channel, 4 > |
PixelType | ( | const PixelType< uInt8Channel, 4 > & | p | ) | [inline] |
conversion constructor
Definition at line 401 of file image.h.
{ switch (NumChans) { // this switch gets resolved at compile time case 1: m_pixel[0] = ChanType(uInt16Channel((uInt8)p.m_pixel[0]*77 + (uInt8)p.m_pixel[1]*150 + (uInt8)p.m_pixel[2]*28)); break; // cppcheck mistakenly warns about array bounds here -- ignore it. case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; break; case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; m_pixel[3] = p.m_pixel[3]; break; } }
PixelType | ( | const PixelType< uInt8Channel, 3 > & | p | ) | [inline] |
conversion constructor
Definition at line 419 of file image.h.
{ switch (NumChans) { // this switch gets resolved at compile time case 1: m_pixel[0] = ChanType(uInt16Channel((uInt8)p.m_pixel[0]*77 + (uInt8)p.m_pixel[1]*150 + (uInt8)p.m_pixel[2]*28)); break; case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; break; case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; m_pixel[3] = ChanType(float32Channel(1.0f)); break; } }
PixelType | ( | const PixelType< uInt8Channel, 1 > & | p | ) | [inline] |
conversion constructor
Definition at line 437 of file image.h.
{ switch (NumChans) { // this switch gets resolved at compile time case 1: m_pixel[0] = p.m_pixel[0]; break; case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0]; m_pixel[2] = p.m_pixel[0]; break; case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0]; m_pixel[2] = p.m_pixel[0]; m_pixel[3] = ChanType(float32Channel(1.0f)); ; break; } }
PixelType | ( | const PixelType< uInt16Channel, 4 > & | p | ) | [inline] |
conversion constructor
Definition at line 453 of file image.h.
{ switch (NumChans) { // this switch gets resolved at compile time case 1: m_pixel[0] = ChanType(uInt16Channel((((uInt16)p.m_pixel[0]*19660)>>16) + (((uInt16)p.m_pixel[1]*38666)>>16) + (((uInt16)p.m_pixel[2]*7209 )>>16))); break; case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; break; case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; m_pixel[3] = p.m_pixel[3]; break; } }
PixelType | ( | const PixelType< uInt16Channel, 3 > & | p | ) | [inline] |
conversion constructor
Definition at line 470 of file image.h.
{ switch (NumChans) { // this switch gets resolved at compile time case 1: m_pixel[0] = ChanType(uInt16Channel((((uInt16)p.m_pixel[0]*19660)>>16) + (((uInt16)p.m_pixel[1]*38666)>>16) + (((uInt16)p.m_pixel[2]*7209 )>>16))); break; case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; break; case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; m_pixel[3] = ChanType(float32Channel(1.0f)); break; } }
PixelType | ( | const PixelType< uInt16Channel, 1 > & | p | ) | [inline] |
conversion constructor
Definition at line 488 of file image.h.
{ switch (NumChans) { // this switch gets resolved at compile time case 1: m_pixel[0] = p.m_pixel[0]; break; case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0]; m_pixel[2] = p.m_pixel[0]; break; case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0]; m_pixel[2] = p.m_pixel[0]; m_pixel[3] = ChanType(float32Channel(1.0f)); break; } }
PixelType | ( | const PixelType< float16Channel, 4 > & | p | ) | [inline] |
conversion constructor
Definition at line 504 of file image.h.
{ switch (NumChans) { // this switch gets resolved at compile time case 1: m_pixel[0] = ChanType(float32Channel(((float)p.m_pixel[0]*0.30f) + ((float)p.m_pixel[1]*0.59f) + ((float)p.m_pixel[2]*0.11f))); break; case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; break; case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; m_pixel[3] = p.m_pixel[3]; break; } }
PixelType | ( | const PixelType< float16Channel, 3 > & | p | ) | [inline] |
conversion constructor
Definition at line 521 of file image.h.
{ switch (NumChans) { // this switch gets resolved at compile time case 1: m_pixel[0] = ChanType(float32Channel(((float)p.m_pixel[0]*0.30f) + ((float)p.m_pixel[1]*0.59f) + ((float)p.m_pixel[2]*0.11f))); break; case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; break; case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; m_pixel[3] = ChanType(float32Channel(1.0f)); break; } }
PixelType | ( | const PixelType< float16Channel, 1 > & | p | ) | [inline] |
conversion constructor
Definition at line 539 of file image.h.
{ switch (NumChans) { // this switch gets resolved at compile time case 1: m_pixel[0] = p.m_pixel[0]; break; case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0]; m_pixel[2] = p.m_pixel[0]; break; case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0]; m_pixel[2] = p.m_pixel[0]; m_pixel[3] = ChanType(float32Channel(1.0f)); break; } }
PixelType | ( | const PixelType< float32Channel, 4 > & | p | ) | [inline] |
conversion constructor
Definition at line 555 of file image.h.
{ switch (NumChans) { // this switch gets resolved at compile time case 1: m_pixel[0] = ChanType(float32Channel(((float)p.m_pixel[0]*0.30f) + ((float)p.m_pixel[1]*0.59f) + ((float)p.m_pixel[2]*0.11f))); break; case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; break; case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; m_pixel[3] = p.m_pixel[3]; break; } }
PixelType | ( | const PixelType< float32Channel, 3 > & | p | ) | [inline] |
conversion constructor
Definition at line 572 of file image.h.
{ switch (NumChans) { // this switch gets resolved at compile time case 1: m_pixel[0] = ChanType(float32Channel(((float)p.m_pixel[0]*0.30f) + ((float)p.m_pixel[1]*0.59f) + ((float)p.m_pixel[2]*0.11f))); break; case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; break; case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[1]; m_pixel[2] = p.m_pixel[2]; m_pixel[3] = ChanType(float32Channel(1.0f)); break; } }
PixelType | ( | const PixelType< float32Channel, 1 > & | p | ) | [inline] |
conversion constructor
Definition at line 590 of file image.h.
{ switch (NumChans) { // this switch gets resolved at compile time case 1: m_pixel[0] = p.m_pixel[0]; break; case 3: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0]; m_pixel[2] = p.m_pixel[0]; break; case 4: m_pixel[0] = p.m_pixel[0]; m_pixel[1] = p.m_pixel[0]; m_pixel[2] = p.m_pixel[0]; m_pixel[3] = ChanType(float32Channel(1.0f)); break; } }
PixelType<ChanType, NumChans>& swapRB | ( | ) | [inline] |
void SetLuminance | ( | const PixelType< uInt8Channel, 4 > & | p | ) | [inline] |
void SetLuminance | ( | const PixelType< uInt8Channel, 3 > & | p | ) | [inline] |
void SetLuminance | ( | const PixelType< uInt16Channel, 4 > & | p | ) | [inline] |
RGBA = Luminance of input.
void SetLuminance | ( | const PixelType< uInt16Channel, 3 > & | p | ) | [inline] |
RGBA = Luminance of input.
void SetLuminance | ( | const PixelType< float16Channel, 4 > & | p | ) | [inline] |
void SetLuminance | ( | const PixelType< float16Channel, 3 > & | p | ) | [inline] |
void SetLuminance | ( | const PixelType< float32Channel, 4 > & | p | ) | [inline] |
void SetLuminance | ( | const PixelType< float32Channel, 3 > & | p | ) | [inline] |
void SetLuminance | ( | const PixelType< float32Channel, 1 > & | p | ) | [inline] |
void SetLuminance | ( | const PixelType< float16Channel, 1 > & | p | ) | [inline] |
void SetLuminance | ( | const PixelType< uInt16Channel, 1 > & | p | ) | [inline] |
void SetLuminance | ( | const PixelType< uInt8Channel, 1 > & | p | ) | [inline] |
void SetInvLuminance | ( | const PixelType< uInt8Channel, 4 > & | p | ) | [inline] |
void SetInvLuminance | ( | const PixelType< uInt8Channel, 3 > & | p | ) | [inline] |
void SetInvLuminance | ( | const PixelType< uInt16Channel, 4 > & | p | ) | [inline] |
RGBA = 1 - Luminance of input.
void SetInvLuminance | ( | const PixelType< uInt16Channel, 3 > & | p | ) | [inline] |
RGBA = 1 - Luminance of input.
void SetInvLuminance | ( | const PixelType< float16Channel, 4 > & | p | ) | [inline] |
void SetInvLuminance | ( | const PixelType< float16Channel, 3 > & | p | ) | [inline] |
void SetInvLuminance | ( | const PixelType< float32Channel, 4 > & | p | ) | [inline] |
void SetInvLuminance | ( | const PixelType< float32Channel, 3 > & | p | ) | [inline] |
void SetInvLuminance | ( | const PixelType< float32Channel, 1 > & | p | ) | [inline] |
void SetInvLuminance | ( | const PixelType< float16Channel, 1 > & | p | ) | [inline] |
void SetInvLuminance | ( | const PixelType< uInt16Channel, 1 > & | p | ) | [inline] |
void SetInvLuminance | ( | const PixelType< uInt8Channel, 1 > & | p | ) | [inline] |
friend class PixelType< uInt8Channel,1 >
[friend] |
friend class PixelType< uInt8Channel,3 >
[friend] |
friend class PixelType< uInt8Channel,4 >
[friend] |
friend class PixelType< uInt16Channel,1 >
[friend] |
friend class PixelType< uInt16Channel,3 >
[friend] |
friend class PixelType< uInt16Channel,4 >
[friend] |
friend class PixelType< float16Channel, 1
> [friend] |
friend class PixelType< float16Channel, 3
> [friend] |
friend class PixelType< float16Channel, 4
> [friend] |
friend class PixelType< float32Channel, 1
> [friend] |
friend class PixelType< float32Channel, 3
> [friend] |
friend class PixelType< float32Channel, 4
> [friend] |