Isis software documentation

Image Color Manipulations

This library provides routines for manipulating the color of an image. This includes color space transformations, as well as some attempts at color-correcting an image sequence to account for different illuminations and camera sensor properties.


RGB to YBR

(image-color-rgb-to-y rgbbuf ybuf) # convert RGB to Y (image-color-rgb-to-br rgbbuf brbuf) # convert RGB to BR (short-sampled) (image-color-ybr-to-rgb ybuf brbuf rgbbuf) # convert YBR to RGB These functions convert images between the RGB (red, green, blue) and YBR (luminance, normalized red, normalized blue) color spaces. rgbbuf must be a three-channel byte-sampled image. ybuf should be a one-channel byte-sampled image. brbuf must be a two-channel short-sampled image (to handle negative values). The B component should be in channel 0 of this image, and the R component in channel 1. The return value in all cases is the output buffer (same as the last argument).


RGB to YUV

(new-yuv-image framesize) # create a new YUV image (image-color-rgb-to-yuv rgbbuf) # create new YUV image from RGB image (image-color-yuv-to-rgb yuvbuf) # create new RGB image from YUV image (image-color-rgb-to-yuv rgbbuf brtemp yuvbuf) # convert RGB to YUV (image-color-yuv-to-rgb yuvbuf brtemp rgbbuf) # convert YUV to RGB These functions convert images between the RGB and YUV color spaces. In YUV, the chrominance information is sampled in bytes and has half the horizontal resolution as the luminance channel. Many video capture/display devices handle YUV formatted data more efficiently than RGB.

YUV images in Isis are handled as a list of two byte-sampled image buffers, [ y-buf uv-buf ], where uv-buf should have 2 channels and have exactly half the horizontal resolution as the 1-channel y-buf. new-yuv-image will allocate a new YUV image and return it in this format. The framesize specified to new-yuv-image should be the size of the Y channel, not the UV channels.

image-color-rgb-to-yuv and image-color-yuv-to-rgb can both be used in two different ways. In the first way, only one argument, the input image buffer, is passed to the function. In this version, a new output buffer is created and returned containing the result of the transformation. In the second way, three arguments are passed: the input image buffer, a short-sampled image buffer used for temporary processing, and the output image buffer. In this version, the result of the transformation is placed in the specified output buffer, which is also the return value.

In both functions, rgbbuf should be a three-channel byte-sampled image. yuvbuf should be a list of two byte-sampled images as discussed above. The brtemp buffer should be a two-channel short-sampled image buffer with the same dimensions as rgbbuf. This buffer is used only as a holding place for temporary data during the transformation.


RGB to YIQ

(image-color-rgb-to-yiq rgbbuf yiqbuf) # convert RGB to YIQ (image-color-yiq-to-rgb yiqbuf rgbbuf) # convert YIQ to RGB These functions converts an image between the RGB and YIQ color spaces. YIQ was proposed by the NTSC committee and corresponds to luminance (Y), in-phase (I) and quadrature-phase (Q). The I and Q channels fall roughly along the red-cyan and green-magenta axes, respectively. As in digital video standard CCIR-601, the I and Q channels are mean-centered around 128, not 0. Therefore, rgbbuf and yiqbuf should both be three-channel byte-sampled images.


Color Constancy Correction

(image-color-relax br-buf edge-buf num-iterations)

These functions are attempts at color correction. When they are working, I will document them better.

br-buf should be a two-channel short-sampled image buffer containing chrominance information. edge-buf should be a one-channel byte-sampled image containing luminance edge information. num-iterations should be an integer indicating the number of iterations to perform. The return value is a new two-channel short-sampled image buffer containing processed chrominance information. The function iteratively relaxes a color computation, taking into account luminance (and large chrominance) edges.


Requirements:
Scripts: (load "image-color.isis")
Libraries: -lisis_color
Headers: isis_color.h
Binders: bind_color_library(script);


Thanks to John Watlington and Jon Dakss for their contributions to this library.