Color values of different color formats (described here) are stored in tlColor objects. They are used as arguments to color filtering and color extraction routines.
tlColor::tlColor | ( | ) |
Constructor, initializes color format to RGB.
References b, format, g, i, intensity, r, raw, RGB, TL_MAX_CHANNEL, and TL_NO_ERROR.
tlColor::tlColor | ( | tlColor * | src | ) |
Constructor, creates a copy of an existing color.
src | color to copy |
References b, format, g, h1, h2, i, intensity, ng, nr, r, raw, s, TL_ERRNO_MSG, TL_ERROR_NULL_POINTER, TL_MAX_CHANNEL, TL_NO_ERROR, u, v, and y.
Constructor, initializes color format to RGB.
r | R color values [0..255] | |
g | G color values [0..255] | |
b | B color values [0..255] |
References format, i, intensity, raw, RGB, TL_MAX_CHANNEL, and TL_NO_ERROR.
Constructor, initialises color format to HSI.
h1 | H1 (coarse) color values [0..255] | |
h2 | H2 (fine) color values [0..255] | |
s | S color values [0..255] | |
i | I color values [0..255] |
References format, HSI, intensity, raw, TL_MAX_CHANNEL, and TL_NO_ERROR.
Constructor, initializes color format to NRG.
nr | NR color value [0..255] | |
ng | NG color value [0..255] |
References format, i, intensity, NRG, raw, TL_MAX_CHANNEL, and TL_NO_ERROR.
tlColor::tlColor | ( | tlPixel | intensity | ) |
Constructor, initializes color format to GRAY.
intensity | GRAY color values [0..255] |
References format, GRAY, i, raw, TL_MAX_CHANNEL, and TL_NO_ERROR.
tlColor::~tlColor | ( | ) | [virtual] |
int tlColor::copy | ( | tlColor * | color | ) |
Copy data from another color.
color | color to copy |
References b, format, g, h1, h2, i, intensity, ng, nr, r, raw, s, TL_ERRNO_MSG, TL_ERROR_NULL_POINTER, TL_MAX_CHANNEL, u, v, and y.
int tlColor::copyTo | ( | tlColor * | color | ) |
Copy data to another color.
color | [out] color to copy to |
References b, format, g, h1, h2, i, intensity, ng, nr, r, raw, s, TL_ERRNO_MSG, TL_ERROR_NULL_POINTER, TL_MAX_CHANNEL, u, v, and y.
int tlColor::setChannel | ( | int | channel, | |
tlPixel | val | |||
) |
Set color value for a particular channel.
channel | channel to be affected | |
val | new channel value |
References raw.
int tlColor::swapChannels | ( | int | channel1, | |
int | channel2 | |||
) |
Swap two channel values.
channel1 | channel to be swapped | |
channel2 | channel to be swapped |
References raw, TL_ERRNO_MSG, TL_ERROR_INDEX_OUT_OF_BOUNDS, and TL_MAX_CHANNEL.
int tlColor::set | ( | tlPixelArray * | pixelArray, | |
tlPoint * | point | |||
) |
Set the color argument to the pixel value of a given pixel array.
pixelArray | source pixel array to get color from | |
point | pixel to consider in the pixel array |
References tlLocation::x, and tlLocation::y.
Referenced by tlPixelArray::getColor().
int tlColor::set | ( | tlPixelArray * | pixelArray, | |
int | x, | |||
int | y | |||
) |
Set the color argument to the pixel value of a given pixel array.
pixelArray | source pixel array to get color from | |
x | X coord of the pixel to consider | |
y | Y coord of the pixel to consider |
References b, BIN, tlPixelArray::format, format, g, tlPixelArray::getPixel(), GRAY, h1, h2, tlPixelArray::hr, HSI, i, intensity, ng, nr, NRG, tlPixelArray::pixelWidth, r, raw, RGB, s, TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NULL_POINTER, u, v, and YUV.
Set the RGB color value.
r | R color value [0..255] | |
g | G color value [0..255] | |
b | B color value [0..255] |
Set the YUV color value.
y | Y color value [0..255] | |
u | U color value [0..255] | |
v | V color value [0..255] |
Set NRG color value.
nr | NR color value [0..255] | |
ng | NG color value [0..255]; |
Set HSI color value.
h1 | H (coarse) color values [0..255] | |
h2 | H (fine) color values [0..255] | |
s | S color values [0..255] | |
i | I color values [0..255] |
int tlColor::setGray | ( | tlPixel | intensity | ) |
Set GRAY color value.
intensity | GRAY color value [0..255] |
References raw.
int tlColor::setMin | ( | tlPixelArray * | pixelArray, | |
tlRect * | rect | |||
) |
Set color to the lowest value in a portion of a given pixel array; color takes the format of the input pixel array.
pixelArray | the pixel array to extract the color from | |
rect | the portion of the pixel array to consider |
References BIN, tlPixelArray::format, format, GRAY, tlSize::height, tlPixelArray::hr, HSI, NRG, tlPixelArray::pixel, RGB, TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NULL_POINTER, tl_extract_color_min_gray(), tl_extract_color_min_hsi(), tl_extract_color_min_nrg(), tl_extract_color_min_rgb(), tl_extract_color_min_yuv(), tlSize::width, and YUV.
int tlColor::setMax | ( | tlPixelArray * | pixelArray, | |
tlRect * | rect | |||
) |
Set color to the highest value in a portion of a given pixel array; color takes the format of the input pixel array.
pixelArray | the pixel array to extract the color from | |
rect | the portion of the pixel array to consider |
References BIN, tlPixelArray::format, format, GRAY, tlSize::height, tlPixelArray::hr, HSI, NRG, tlPixelArray::pixel, RGB, TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NULL_POINTER, tl_extract_color_max_gray(), tl_extract_color_max_hsi(), tl_extract_color_max_nrg(), tl_extract_color_max_rgb(), tl_extract_color_max_yuv(), tlSize::width, and YUV.
int tlColor::setVar | ( | tlPixelArray * | pixelArray, | |
tlRect * | rect | |||
) |
Set color to the maximum variation in a portion of a given pixel array; color takes the format of the input pixel array.
pixelArray | the pixel array to extract the color from | |
rect | the portion of the pixel array to consider |
References BIN, copy(), tlPixelArray::format, format, GRAY, tlSize::height, tlPixelArray::hr, HSI, NRG, tlPixelArray::pixel, RGB, sub(), TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NULL_POINTER, tl_extract_color_max_gray(), tl_extract_color_max_hsi(), tl_extract_color_max_nrg(), tl_extract_color_max_rgb(), tl_extract_color_max_yuv(), tl_extract_color_min_gray(), tl_extract_color_min_hsi(), tl_extract_color_min_nrg(), tl_extract_color_min_rgb(), tl_extract_color_min_yuv(), tlSize::width, and YUV.
int tlColor::toRgb | ( | ) |
Convert color to RGB format (if possible).
References b, format, g, h1, h2, HSI, intensity, r, RGB, s, TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NOT_REQUIRED, TL_MAX, TL_MAX_PIXEL_VAL, TL_MIN, TL_MIN_PIXEL_VAL, TL_PI, u, v, y, and YUV.
int tlColor::toNrg | ( | ) |
Convert color to NRG format (if possible).
References b, format, g, HSI, intensity, ng, nr, NRG, r, RGB, TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NOT_REQUIRED, TL_MAX_PIXEL_VAL, TL_MIN_PIXEL_VAL, toRgb(), u, v, y, and YUV.
int tlColor::toHsi | ( | ) |
Convert color to HSI format (if possible).
References b, format, g, h1, h2, HSI, intensity, r, RGB, s, TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NOT_REQUIRED, TL_MAX_PIXEL_VAL, TL_MIN, TL_PI, toRgb(), and YUV.
int tlColor::toGray | ( | ) |
Convert color to GRAY format if (possible).
References b, format, g, GRAY, HSI, i, intensity, ng, nr, NRG, r, RGB, TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NOT_REQUIRED, y, and YUV.
int tlColor::toBin | ( | int | threshold | ) |
Convert color to BIN format if (possible).
threshold | threshold value for pixel (de)activation |
References BIN, format, GRAY, HSI, intensity, NRG, RGB, TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NOT_REQUIRED, TL_MAX_PIXEL_VAL, TL_MIN_PIXEL_VAL, and YUV.
int tlColor::add | ( | tlColor * | color | ) |
Perform color addition.
color | color to add to current color |
References b, BIN, format, g, GRAY, h1, h2, HSI, i, intensity, ng, nr, NRG, r, RGB, s, TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NULL_POINTER, TL_MAX_PIXEL_VAL, TL_MIN, u, v, y, and YUV.
Perform color addition; the result is placed in another color object.
color | color to add to current color | |
dest | [out] destination color |
References b, BIN, copy(), format, g, GRAY, h1, h2, HSI, i, intensity, ng, nr, NRG, r, RGB, s, TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NULL_POINTER, TL_MAX_PIXEL_VAL, TL_MIN, u, v, y, and YUV.
int tlColor::sub | ( | tlColor * | color | ) |
Perform color subtraction.
color | color to sub from current color |
References b, BIN, format, g, GRAY, h1, h2, HSI, i, intensity, ng, nr, NRG, r, RGB, s, TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NULL_POINTER, u, v, y, and YUV.
Referenced by setVar().
Perform color subtraction; the result is placed in another color object.
color | color to sub from current color | |
dest | destination color |
References b, BIN, copy(), format, g, GRAY, h1, h2, HSI, i, intensity, ng, nr, NRG, r, RGB, s, TL_ERRNO_MSG, TL_ERROR_INVALID_FORMAT, TL_ERROR_NULL_POINTER, u, v, y, and YUV.
Color format.
Referenced by add(), copy(), copyTo(), tlObject::define(), tlPixelArray::filter(), tlPixelArray::getColorMax(), tlPixelArray::getColorMin(), tlPixelArray::getColors(), set(), setHsi(), setMax(), setMin(), setNrg(), setRgb(), setVar(), setYuv(), sub(), tlColorModel::test(), tlColor(), toBin(), toGray(), toHsi(), toNrg(), and toRgb().
tlPixel tlColor::raw[TL_MAX_CHANNEL] |
GRAY (intensity) component.
Referenced by add(), copy(), copyTo(), tlObject::extract(), tlPixelArray::filter(), set(), setHsi(), setNrg(), setRgb(), setYuv(), sub(), tl_extract_color_gray(), tl_extract_color_max_gray(), tl_extract_color_min_gray(), tlColor(), toBin(), toGray(), toHsi(), toNrg(), and toRgb().
R (red) component.
Referenced by add(), copy(), copyTo(), tlObject::extract(), tlPixelArray::filter(), set(), sub(), tl_extract_color_max_rgb(), tl_extract_color_min_rgb(), tl_extract_color_rgb(), tlColor(), toGray(), toHsi(), toNrg(), and toRgb().
G (green) component.
Referenced by add(), copy(), copyTo(), tlObject::extract(), tlPixelArray::filter(), set(), sub(), tl_extract_color_max_rgb(), tl_extract_color_min_rgb(), tl_extract_color_rgb(), tlColor(), toGray(), toHsi(), toNrg(), and toRgb().
B (blue) component.
Referenced by add(), copy(), copyTo(), tlObject::extract(), tlPixelArray::filter(), set(), sub(), tl_extract_color_max_rgb(), tl_extract_color_min_rgb(), tl_extract_color_rgb(), tlColor(), toGray(), toHsi(), toNrg(), and toRgb().
Y (luma) component.
Referenced by add(), copy(), copyTo(), sub(), tl_extract_color_max_yuv(), tl_extract_color_min_yuv(), tl_extract_color_yuv(), tlColor(), toGray(), toNrg(), and toRgb().
U (R-Y) component.
Referenced by add(), copy(), copyTo(), set(), sub(), tl_extract_color_max_yuv(), tl_extract_color_min_yuv(), tl_extract_color_yuv(), tlColor(), toNrg(), and toRgb().
V (B-Y) component.
Referenced by add(), copy(), copyTo(), set(), sub(), tl_extract_color_max_yuv(), tl_extract_color_min_yuv(), tl_extract_color_yuv(), tlColor(), toNrg(), and toRgb().
NR (normalized red) component.
Referenced by add(), copy(), copyTo(), tlObject::extract(), tlPixelArray::filter(), set(), sub(), tlColorModel::test(), tl_extract_color_max_nrg(), tl_extract_color_min_nrg(), tl_extract_color_nrg(), tlColor(), toGray(), and toNrg().
NG (normalized green) component.
Referenced by add(), copy(), copyTo(), tlObject::extract(), tlPixelArray::filter(), set(), sub(), tlColorModel::test(), tl_extract_color_max_nrg(), tl_extract_color_min_nrg(), tl_extract_color_nrg(), tlColor(), toGray(), and toNrg().
H1 (hue, coarse) component.
Referenced by add(), copy(), copyTo(), tlPixelArray::filter(), set(), sub(), tlColorModel::test(), tl_extract_color_hsi(), tl_extract_color_max_hsi(), tl_extract_color_min_hsi(), tlColor(), toHsi(), and toRgb().
H2 (hue, fine) component.
Referenced by add(), copy(), copyTo(), tlPixelArray::filter(), set(), sub(), tl_extract_color_hsi(), tl_extract_color_max_hsi(), tl_extract_color_min_hsi(), tlColor(), toHsi(), and toRgb().
S (saturation) component.
Referenced by add(), copy(), copyTo(), tlPixelArray::filter(), set(), sub(), tlColorModel::test(), tl_extract_color_hsi(), tl_extract_color_max_hsi(), tl_extract_color_min_hsi(), tlColor(), toHsi(), and toRgb().
I (intensity) component.
Referenced by add(), copy(), copyTo(), tlPixelArray::filter(), set(), sub(), tl_extract_color_hsi(), tl_extract_color_max_hsi(), tl_extract_color_min_hsi(), tlColor(), and toGray().