latest version v1.9 - last update 10 Apr 2010 |
Template to use RGB pixel representations of types other than ubyte
.
More...
#include <ltiRGBPixel.h>
Public Types | |
typedef T | value_type |
typedef int | size_type |
Public Member Functions | |
trgbPixel () | |
trgbPixel (const T g) | |
trgbPixel (const T r, const T g, const T b) | |
trgbPixel (const trgbPixel< T > &p) | |
trgbPixel (const rgbPixel &p) | |
void | get (T &r, T &g, T &b) const |
const T & | getRed () const |
const T & | getGreen () const |
const T & | getBlue () const |
void | set (const T r, const T g, const T b) |
void | setRed (const T r) |
void | setGreen (const T g) |
void | setBlue (const T b) |
T & | at (const int x) |
const T & | at (const int x) const |
T & | operator[] (const int x) |
const T & | operator[] (const int x) const |
int | size () const |
trgbPixel< T > & | copy (const trgbPixel< T > &other) |
trgbPixel< T > & | copy (const rgbPixel &other) |
trgbPixel< T > & | operator= (const trgbPixel< T > &other) |
trgbPixel< T > & | operator= (const rgbPixel &other) |
template<class U > | |
trgbPixel< T > & | castFrom (const trgbPixel< U > &other) |
bool | isEqual (const trgbPixel< T > &other) const |
bool | operator== (const trgbPixel< T > &other) const |
bool | operator!= (const trgbPixel< T > &other) const |
bool | operator< (const trgbPixel< T > &other) const |
bool | operator> (const trgbPixel< T > &other) const |
trgbPixel< T > & | add (const trgbPixel< T > &other) |
trgbPixel< T > & | add (const trgbPixel< T > &a, const trgbPixel< T > &b) |
trgbPixel< T > & | add (const T val) |
trgbPixel< T > & | operator+= (const trgbPixel< T > &other) |
trgbPixel< T > | operator+ (const trgbPixel< T > &other) const |
trgbPixel< T > | addScaled (const T b, const trgbPixel< T > &other) |
trgbPixel< T > | addScaled (const T a, const trgbPixel< T > &pixa, const T b, const trgbPixel< T > &pixb) |
trgbPixel< T > | addScaled (const trgbPixel< T > &pixa, const T b, const trgbPixel< T > &pixb) |
trgbPixel< T > | addScaled (const T a, const T b, const trgbPixel< T > &pixb) |
trgbPixel< T > & | subtract (const trgbPixel< T > &other) |
trgbPixel< T > & | subtract (const trgbPixel< T > &a, const trgbPixel< T > &b) |
trgbPixel< T > & | subtract (const T val) |
trgbPixel< T > & | operator-= (const trgbPixel< T > &other) |
trgbPixel< T > | operator- (const trgbPixel< T > &other) const |
trgbPixel< T > & | multiply (const trgbPixel< T > &other) |
trgbPixel< T > & | multiply (const trgbPixel< T > &a, const trgbPixel< T > &b) |
trgbPixel< T > & | multiply (const T c) |
trgbPixel< T > & | multiply (const trgbPixel< T > &other, const T val) |
trgbPixel< T > & | operator*= (const trgbPixel< T > &other) |
trgbPixel< T > | operator* (const trgbPixel< T > &other) const |
trgbPixel< T > | operator*= (const T other) |
trgbPixel< T > | operator* (const T c) const |
trgbPixel< T > & | divide (const T c) |
trgbPixel< T > | operator/ (const T c) const |
trgbPixel< T > & | divide (const trgbPixel< T > &other, const T val) |
trgbPixel< T > & | operator/= (const T c) |
trgbPixel< T > & | divide (const trgbPixel< T > &c) |
trgbPixel< T > & | divide (const trgbPixel< T > &a, const trgbPixel< T > &b) |
trgbPixel< T > | operator/ (const trgbPixel< T > &c) const |
trgbPixel< T > & | operator/= (const trgbPixel< T > &c) |
T | absSqr () const |
T | distanceSqr (const trgbPixel< T > &other) const |
T | dot (const trgbPixel< T > &other) const |
rgbPixel | getRGBPixel () const |
rgbPixel | getClippedRGBPixel () const |
trgbPixel< T > & | apply (T(*function)(T)) |
trgbPixel< T > & | apply (T(*function)(const T &)) |
Public Attributes | |
T | red |
T | green |
T | blue |
Template to use RGB pixel representations of types other than ubyte
.
The type rgbPixel
optimize speed and memory use. If you need RGB integer values between 0 and 255, you should use rgbPixel instead (much more efficient!)
typedef int lti::trgbPixel< T >::size_type |
return type of the size() member
typedef T lti::trgbPixel< T >::value_type |
used for the template-based interface for pixels as vectors.
lti::trgbPixel< T >::trgbPixel | ( | ) | [inline] |
default constructor
lti::trgbPixel< T >::trgbPixel | ( | const T | g | ) | [inline, explicit] |
gray value constructor
lti::trgbPixel< T >::trgbPixel | ( | const T | r, | |
const T | g, | |||
const T | b | |||
) | [inline] |
default constructor
lti::trgbPixel< T >::trgbPixel | ( | const trgbPixel< T > & | p | ) | [inline] |
copy constructor
lti::trgbPixel< T >::trgbPixel | ( | const rgbPixel & | p | ) | [inline] |
copy constructor
T lti::trgbPixel< T >::absSqr | ( | ) | const [inline] |
obtain the square of the magnitud of this pixel .
trgbPixel<T>& lti::trgbPixel< T >::add | ( | const T | val | ) | [inline] |
add a constant to each component of the pixel
trgbPixel<T>& lti::trgbPixel< T >::add | ( | const trgbPixel< T > & | a, | |
const trgbPixel< T > & | b | |||
) | [inline] |
Add pixels a and b leave the result here.
trgbPixel<T>& lti::trgbPixel< T >::add | ( | const trgbPixel< T > & | other | ) | [inline] |
add two pixels
Referenced by lti::trgbPixel< int >::operator+(), and lti::trgbPixel< int >::operator+=().
trgbPixel<T> lti::trgbPixel< T >::addScaled | ( | const T | a, | |
const T | b, | |||
const trgbPixel< T > & | pixb | |||
) | [inline] |
scale this pixel with a, and add to the result the scaled pixel pixb (scaling factor b), i.e.
*this = *this*a + pb*b
trgbPixel<T> lti::trgbPixel< T >::addScaled | ( | const trgbPixel< T > & | pixa, | |
const T | b, | |||
const trgbPixel< T > & | pixb | |||
) | [inline] |
assign to this pixel the sum of the pixel pixa and the scaled pixel pixb (scaling factor b), i.e.
*this = pa + pb*b
trgbPixel<T> lti::trgbPixel< T >::addScaled | ( | const T | a, | |
const trgbPixel< T > & | pixa, | |||
const T | b, | |||
const trgbPixel< T > & | pixb | |||
) | [inline] |
assign to this pixel the sum of the scaled pixels with their respective scaling factors, i.e.
*this = pa*a + pb*b
trgbPixel<T> lti::trgbPixel< T >::addScaled | ( | const T | b, | |
const trgbPixel< T > & | other | |||
) | [inline] |
add to this pixel the other pixel scaled by the given constant
trgbPixel<T>& lti::trgbPixel< T >::apply | ( | T(*)(const T &) | function | ) | [inline] |
apply a C-function to each component of the pixel
trgbPixel<T>& lti::trgbPixel< T >::apply | ( | T(*)(T) | function | ) | [inline] |
apply a C-function to each component of the pixel
const T& lti::trgbPixel< T >::at | ( | const int | x | ) | const [inline] |
T& lti::trgbPixel< T >::at | ( | const int | x | ) | [inline] |
trgbPixel<T>& lti::trgbPixel< T >::castFrom | ( | const trgbPixel< U > & | other | ) | [inline] |
convert between pixels of different types
trgbPixel<T>& lti::trgbPixel< T >::copy | ( | const rgbPixel & | other | ) | [inline] |
copy member
trgbPixel<T>& lti::trgbPixel< T >::copy | ( | const trgbPixel< T > & | other | ) | [inline] |
copy member
Referenced by lti::trgbPixel< int >::operator=().
T lti::trgbPixel< T >::distanceSqr | ( | const trgbPixel< T > & | other | ) | const [inline] |
returns the square of the distance of this pixel to the other one defined as .
Referenced by lti::distanceSqr().
trgbPixel<T>& lti::trgbPixel< T >::divide | ( | const trgbPixel< T > & | a, | |
const trgbPixel< T > & | b | |||
) | [inline] |
Elementwise divide between the elements of a and b.
trgbPixel<T>& lti::trgbPixel< T >::divide | ( | const trgbPixel< T > & | c | ) | [inline] |
elementwise divide
trgbPixel<T>& lti::trgbPixel< T >::divide | ( | const trgbPixel< T > & | other, | |
const T | val | |||
) | [inline] |
divide the elements of the other pixel with the given value, and leave the result here.
trgbPixel<T>& lti::trgbPixel< T >::divide | ( | const T | c | ) | [inline] |
divide by a constant
Referenced by lti::trgbPixel< int >::operator/(), and lti::trgbPixel< int >::operator/=().
T lti::trgbPixel< T >::dot | ( | const trgbPixel< T > & | other | ) | const [inline] |
computes the dot product with another pixel, which is define as the sum of the products of all corresponding components, i.e.
p1.red*p2.red + p1.green*p2.green + p1.blue*p2.blue, where p1 is this pixel.
void lti::trgbPixel< T >::get | ( | T & | r, | |
T & | g, | |||
T & | b | |||
) | const [inline] |
Get the three color components and write them in the given arguments.
const T& lti::trgbPixel< T >::getBlue | ( | ) | const [inline] |
returns blue value
Referenced by lti::trgbPixel< int >::castFrom(), lti::cityBlockDistance(), lti::rgbPixel::rgbPixel(), and lti::write().
rgbPixel lti::trgbPixel< T >::getClippedRGBPixel | ( | ) | const [inline] |
return a normal lti::rgbPixel Values lower than 0 are set to 0 and values higher than 255 are set to 255.
This method is slower than getRGBPixel() due to the extra comparisons
const T& lti::trgbPixel< T >::getGreen | ( | ) | const [inline] |
returns green value
Referenced by lti::trgbPixel< int >::castFrom(), lti::cityBlockDistance(), lti::rgbPixel::rgbPixel(), and lti::write().
const T& lti::trgbPixel< T >::getRed | ( | ) | const [inline] |
returns red value
Referenced by lti::trgbPixel< int >::castFrom(), lti::cityBlockDistance(), lti::rgbPixel::rgbPixel(), and lti::write().
rgbPixel lti::trgbPixel< T >::getRGBPixel | ( | ) | const [inline] |
return a normal lti::rgbPixel You should ensure that the values are all in a valid interval!
bool lti::trgbPixel< T >::isEqual | ( | const trgbPixel< T > & | other | ) | const [inline] |
compare member: returns true if this is equal to other
Referenced by lti::trgbPixel< int >::operator!=(), and lti::trgbPixel< int >::operator==().
trgbPixel<T>& lti::trgbPixel< T >::multiply | ( | const trgbPixel< T > & | other, | |
const T | val | |||
) | [inline] |
multiply the elements of the other pixel with the given value, and leave the result here.
trgbPixel<T>& lti::trgbPixel< T >::multiply | ( | const T | c | ) | [inline] |
multiply with a constant
trgbPixel<T>& lti::trgbPixel< T >::multiply | ( | const trgbPixel< T > & | a, | |
const trgbPixel< T > & | b | |||
) | [inline] |
Elementwise multiplication of the elements of a and b.
trgbPixel<T>& lti::trgbPixel< T >::multiply | ( | const trgbPixel< T > & | other | ) | [inline] |
multiply with another pixel.
The pixel multiplication is a elementwise multiplication
Referenced by lti::trgbPixel< int >::operator*(), and lti::trgbPixel< int >::operator*=().
bool lti::trgbPixel< T >::operator!= | ( | const trgbPixel< T > & | other | ) | const [inline] |
alias for !compare()
trgbPixel<T> lti::trgbPixel< T >::operator* | ( | const T | c | ) | const [inline] |
multiply this pixel with another one without altering anything.
..
trgbPixel<T> lti::trgbPixel< T >::operator* | ( | const trgbPixel< T > & | other | ) | const [inline] |
multiply this pixel with another one without altering anything.
..
trgbPixel<T> lti::trgbPixel< T >::operator*= | ( | const T | other | ) | [inline] |
alias for multiply
trgbPixel<T>& lti::trgbPixel< T >::operator*= | ( | const trgbPixel< T > & | other | ) | [inline] |
alias for multiply The pixel multiplication is a elementwise multiplication
trgbPixel<T> lti::trgbPixel< T >::operator+ | ( | const trgbPixel< T > & | other | ) | const [inline] |
add this pixel with the otherone without altering anything.
..
trgbPixel<T>& lti::trgbPixel< T >::operator+= | ( | const trgbPixel< T > & | other | ) | [inline] |
alias for add
trgbPixel<T> lti::trgbPixel< T >::operator- | ( | const trgbPixel< T > & | other | ) | const [inline] |
subtract 'other' from this pixel without altering anything.
..
trgbPixel<T>& lti::trgbPixel< T >::operator-= | ( | const trgbPixel< T > & | other | ) | [inline] |
alias for subtract
trgbPixel<T> lti::trgbPixel< T >::operator/ | ( | const trgbPixel< T > & | c | ) | const [inline] |
elementwise divide
trgbPixel<T> lti::trgbPixel< T >::operator/ | ( | const T | c | ) | const [inline] |
divide by a constant
trgbPixel<T>& lti::trgbPixel< T >::operator/= | ( | const trgbPixel< T > & | c | ) | [inline] |
alias for elementwise divide
trgbPixel<T>& lti::trgbPixel< T >::operator/= | ( | const T | c | ) | [inline] |
alias for divide
bool lti::trgbPixel< T >::operator< | ( | const trgbPixel< T > & | other | ) | const [inline] |
returns true if the intensity of this color is smaller than the intensity of the other color
trgbPixel<T>& lti::trgbPixel< T >::operator= | ( | const rgbPixel & | other | ) | [inline] |
alias for copy member
trgbPixel<T>& lti::trgbPixel< T >::operator= | ( | const trgbPixel< T > & | other | ) | [inline] |
alias for copy member
bool lti::trgbPixel< T >::operator== | ( | const trgbPixel< T > & | other | ) | const [inline] |
alias for compare()
bool lti::trgbPixel< T >::operator> | ( | const trgbPixel< T > & | other | ) | const [inline] |
returns true if the intensity of this color is bigger than the intensity of the other color
const T& lti::trgbPixel< T >::operator[] | ( | const int | x | ) | const [inline] |
T& lti::trgbPixel< T >::operator[] | ( | const int | x | ) | [inline] |
void lti::trgbPixel< T >::set | ( | const T | r, | |
const T | g, | |||
const T | b | |||
) | [inline] |
set the red, green, blue values for the pixel
void lti::trgbPixel< T >::setBlue | ( | const T | b | ) | [inline] |
sets blue value
Referenced by lti::read().
void lti::trgbPixel< T >::setGreen | ( | const T | g | ) | [inline] |
sets green value
Referenced by lti::read().
void lti::trgbPixel< T >::setRed | ( | const T | r | ) | [inline] |
sets red value
Referenced by lti::read().
int lti::trgbPixel< T >::size | ( | ) | const [inline] |
Used to simulate the vector size.
trgbPixel<T>& lti::trgbPixel< T >::subtract | ( | const T | val | ) | [inline] |
subtract the given value from each component of the pixel
trgbPixel<T>& lti::trgbPixel< T >::subtract | ( | const trgbPixel< T > & | a, | |
const trgbPixel< T > & | b | |||
) | [inline] |
Subtract pixel b from pixel a and leave the result here.
trgbPixel<T>& lti::trgbPixel< T >::subtract | ( | const trgbPixel< T > & | other | ) | [inline] |
Subtract the other pixel from the current one and leave the result here.
Referenced by lti::trgbPixel< int >::operator-(), and lti::trgbPixel< int >::operator-=().
T lti::trgbPixel< T >::blue |
blue channel
Referenced by lti::trgbPixel< int >::absSqr(), lti::trgbPixel< int >::add(), lti::trgbPixel< int >::addScaled(), lti::trgbPixel< int >::apply(), lti::trgbPixel< int >::at(), lti::trgbPixel< int >::castFrom(), lti::trgbPixel< int >::copy(), lti::trgbPixel< int >::distanceSqr(), lti::trgbPixel< int >::divide(), lti::trgbPixel< int >::dot(), lti::trgbPixel< int >::get(), lti::trgbPixel< int >::getBlue(), lti::trgbPixel< int >::getClippedRGBPixel(), lti::trgbPixel< int >::getRGBPixel(), lti::trgbPixel< int >::isEqual(), lti::trgbPixel< int >::multiply(), lti::trgbPixel< int >::operator*(), lti::trgbPixel< int >::operator/(), lti::trgbPixel< int >::operator<(), lti::trgbPixel< int >::operator>(), lti::trgbPixel< int >::operator[](), lti::trgbPixel< int >::set(), lti::trgbPixel< int >::setBlue(), and lti::trgbPixel< int >::subtract().
T lti::trgbPixel< T >::green |
green channel
Referenced by lti::trgbPixel< int >::absSqr(), lti::trgbPixel< int >::add(), lti::trgbPixel< int >::addScaled(), lti::trgbPixel< int >::apply(), lti::trgbPixel< int >::at(), lti::trgbPixel< int >::castFrom(), lti::trgbPixel< int >::copy(), lti::trgbPixel< int >::distanceSqr(), lti::trgbPixel< int >::divide(), lti::trgbPixel< int >::dot(), lti::trgbPixel< int >::get(), lti::trgbPixel< int >::getClippedRGBPixel(), lti::trgbPixel< int >::getGreen(), lti::trgbPixel< int >::getRGBPixel(), lti::trgbPixel< int >::isEqual(), lti::trgbPixel< int >::multiply(), lti::trgbPixel< int >::operator*(), lti::trgbPixel< int >::operator/(), lti::trgbPixel< int >::operator<(), lti::trgbPixel< int >::operator>(), lti::trgbPixel< int >::operator[](), lti::trgbPixel< int >::set(), lti::trgbPixel< int >::setGreen(), and lti::trgbPixel< int >::subtract().
T lti::trgbPixel< T >::red |
red channel
Referenced by lti::trgbPixel< int >::absSqr(), lti::trgbPixel< int >::add(), lti::trgbPixel< int >::addScaled(), lti::trgbPixel< int >::apply(), lti::trgbPixel< int >::at(), lti::trgbPixel< int >::castFrom(), lti::trgbPixel< int >::copy(), lti::trgbPixel< int >::distanceSqr(), lti::trgbPixel< int >::divide(), lti::trgbPixel< int >::dot(), lti::trgbPixel< int >::get(), lti::trgbPixel< int >::getClippedRGBPixel(), lti::trgbPixel< int >::getRed(), lti::trgbPixel< int >::getRGBPixel(), lti::trgbPixel< int >::isEqual(), lti::trgbPixel< int >::multiply(), lti::trgbPixel< int >::operator*(), lti::trgbPixel< int >::operator/(), lti::trgbPixel< int >::operator<(), lti::trgbPixel< int >::operator>(), lti::trgbPixel< int >::operator[](), lti::trgbPixel< int >::set(), lti::trgbPixel< int >::setRed(), and lti::trgbPixel< int >::subtract().