BRL-CAD

Functions to change an image from one color space to another. More...

Collaboration diagram for Colorspace:

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)
 

Detailed Description

Functions to change an image from one color space to another.

Macro Definition Documentation

◆ icv_rgb2gray_ntsc

#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.

◆ icv_rgb2gray_crt

#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.

Enumeration Type Documentation

◆ ICV_COLOR

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.

Function Documentation

◆ icv_gray2rgb()

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.

◆ icv_rgb2gray()

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.

Parameters
[in,out]img- image
[in]colorChooses 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]rweightWeight for r-plane
[in]gweightWeight for g-plane
[in]bweightWeight for b-plane
Returns
0 on success; on failure return 1

User can specify weights in the arguments, for the selected color planes. If 0 weight is chosen this utility assigns equal weights.