Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ xil_band_combine(3) — Solaris 2.4 x86 SDK

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

xil_kernel_create(3)

xil_band_combine(3)

NAME

xil_band_combine − interband linear combination operation

SYNOPSIS

#include <xil/xil.h>

void xil_band_combine (XilImage src,

XilImage dst,
XilKernel matrix);

DESCRIPTION

This function performs the arbitrary interband linear combination of an image using the specified matrix.  src is the source image handle.  dst is the destination image handle.  matrix is the floating point matrix used to perform the linear combination.  The width of the matrix must be one larger than the number of bands in the source image.  The height of the matrix must be equal to the number of bands in the destination image.  Because the matrix can be of arbitrary size, this function can be used to produce a destination image with a different number of bands from the source image. 

The destination image is formed by performing a matrix-multiply operation between the bands of the source image and the specified matrix.  The extra column of values is a constant that is added after the matrix-multiply operation takes place.  The matrix is implemented as an XilKernel.  For a source pixel with N bands represented by (s0,s1,s2,...,sN-1), and a destination pixel with M bands represented by (d0,d1,d2,...,
dM-1), the corresponding (N+1) x M matrix:

a00a10a20...aN0
a01a11a21...aN1
 ...
a0(M-1)a1(M-1)a2(M-1)...aN(M-1)

would give for the first element in the destination pixel:

d0 = a00s0 + a10s1 + a20s2 + ... + a(N-1)0s(N-1) + aN0

For example, the following 4x3 matrix would give a destination image equal to the source image:

1.00.00.00.0
0.01.00.00.0
0.00.01.00.0

This 5x1 matrix would select the second band of a 4 band image:

0.01.00.00.00.0

This 4x1 matrix would generate a single-band luminance image from an RGB image with the standard bgr memory format:

0.1140.5870.2990.0

This 4x3 matrix would invert the second band of a 3-band image:

1.00.00.00.0
0.0       -1.00.0     255.0
0.00.01.00.0

Notice that the fourth column of this last matrix corresponds to the "constant" that is added after the multiply-add steps.  It should be in the range appropriate for the source and destination data types. 

ERRORS

For a complete list of XIL error messages by number, consult Appendix B of the XIL Programmer’s Guide. 

EXAMPLES

The following example generates a single-band image that is the normalized sum of all the bands of a three-band source image. 

#include <xil/xil.h>
XilSystemStateState;
XilImagesrc, dst;
XilKernelmatrix;
unsigned intwidth = 4, height = 1;
float∗matrix_values = {0.333, 0.333, 0.333, 0.0}
State = xil_open();
matrix = xil_kernel_create(State, width, height, 0, 0, matrix_values);
/∗ create a dst image the same type as source, but only 1 band ∗/
dst = xil_create(State, xil_get_width(src), xil_get_height(src),
1, xil_get_datatype(src));
xil_band_combine(src, dst, matrix);

NOTES

The key pixel values for the XilKernel object are not used by xil_band_combine (), and are ignored.

SEE ALSO

xil_kernel_create(3)

SunOS   —  Last change: 15 June 1993

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026