BRL-CAD
|
Functions to change an image from one color space to another. More...
Files | |
file | colorspace.h |
Macros | |
#define | icv_rgb2gray_ntsc(_a) icv_rgb2gray(_a, ICV_COLOR_RGB, 0.30, 0.59, 0.11) |
#define | icv_rgb2gray_crt(_a) icv_rgb2gray(_a, ICV_COLOR_RGB, 0.26, 0.66, 0.08) |
Enumerations | |
enum | ICV_COLOR { ICV_COLOR_RGB , ICV_COLOR_R , ICV_COLOR_G , ICV_COLOR_B , ICV_COLOR_RG , ICV_COLOR_RB , ICV_COLOR_BG } |
Functions | |
int | icv_gray2rgb (icv_image_t *img) |
int | icv_rgb2gray (icv_image_t *img, ICV_COLOR color, double rweight, double gweight, double bweight) |
Functions to change an image from one color space to another.
#define icv_rgb2gray_ntsc | ( | _a | ) | icv_rgb2gray(_a, ICV_COLOR_RGB, 0.30, 0.59, 0.11) |
converts image to single channel image by combining three weights based on NTSC primaries and 6500 white.
Definition at line 62 of file colorspace.h.
#define icv_rgb2gray_crt | ( | _a | ) | icv_rgb2gray(_a, ICV_COLOR_RGB, 0.26, 0.66, 0.08) |
converts image to single channel image by combining three weights based on CRT phosphor and D6500 white.
Definition at line 68 of file colorspace.h.
enum ICV_COLOR |
Enumerator | |
---|---|
ICV_COLOR_RGB | |
ICV_COLOR_R | |
ICV_COLOR_G | |
ICV_COLOR_B | |
ICV_COLOR_RG | |
ICV_COLOR_RB | |
ICV_COLOR_BG |
Definition at line 39 of file colorspace.h.
int icv_gray2rgb | ( | icv_image_t * | img | ) |
Converts a single channel image to three channel image. Replicates the pixel as done by bw-pix utility returns a three channel image. If a three channel image is passed, this function returns the same image.
int icv_rgb2gray | ( | icv_image_t * | img, |
ICV_COLOR | color, | ||
double | rweight, | ||
double | gweight, | ||
double | bweight | ||
) |
converts a three channel rgb image to single channel gray-image. This function will combine or select planes of the image based on the input arguments.
A normal calling of this functions is as follows: icv_image_rgb2gray(bif, 0, 0, 0, 0); where bif is the rgb image to be converted.
[in,out] | img | - image |
[in] | color | Chooses color planes to be selected for combination. This function will need color to be specified from ICV_COLOR_R ICV_COLOR_G ICV_COLOR_B ICV_COLOR_RG ICV_COLOR_RB ICV_COLOR_BG ICV_COLOR_RGB |
[in] | rweight | Weight for r-plane |
[in] | gweight | Weight for g-plane |
[in] | bweight | Weight for b-plane |
User can specify weights in the arguments, for the selected color planes. If 0 weight is chosen this utility assigns equal weights.