Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

xil_histogram(3)

xil_histogram_create(3)

xil_histogram_destroy(3)

xil_histogram_get_nbands(3)

NAME

xil_histogram_get_nbands, xil_histogram_get_nbins, xil_histogram_get_limits, xil_histogram_get_values, xil_histogram_get_info − histogram attributes

SYNOPSIS

#include <xil/xil.h>

unsigned int xil_histogram_get_nbands ( XilHistogram histogram);

void xil_histogram_get_nbins ( XilHistogram histogram,

unsigned int ∗nbins);

void xil_histogram_get_limits ( XilHistogram histogram,

float ∗low_value,
float ∗high_value);

void xil_histogram_get_values (XilHistogram histogram,

unsigned int ∗data);

void xil_histogram_get_info ( XilHistogram histogram,

unsigned int ∗nbands,
unsigned int ∗nbins,
float ∗low_value,
float ∗high_value);

DESCRIPTION

These routines read the values of histogram attributes and the intensity-level information stored in the histograms.  Histograms are used to obtain information about the distribution of pixel values in an image.  Create histograms with xil_histogram_create(3). 

xil_histogram_get_nbands() returns the number of bands represented by the histogram.  For example, a histogram with three bands can be thought of as a cube of data, with each axis representing a single band. 

xil_histogram_get_nbins() fills in a user-supplied array, nbins, with values representing the number of histogram bins for each histogram band. 

xil_histogram_get_limits() fills in user-supplied arrays, low_value and high_value, with floating point numbers that represent the central value of the first bin and last bin in each band. 

xil_histogram_get_values() fills in the user-supplied array, data, with the unsigned integer values that make up the histogram data. The data are aligned so that values along the last band’s axis are contiguous.  For example, for a 3 band image, the resulting array would be indexed as

data[band1_bin][band2_bin][band3_bin]. 

The user is responsible for allocating sufficient space to hold the histogram data, bearing in mind that each histgram element is an unsigned int and that the number of elements is the product of nbins for each band. 

xil_histogram_get_info() combines the function of other attribute functions. nbands is filled with the number of bands in the histogram; nbins is filled with the number of bins per band, one for each band.  low_value and high_value are arrays that contain the low and high values for each band. 

ERRORS

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

EXAMPLES

Create an array to hold the histogram data and retrieve the data:

XilHistogram histogram;
unsigned int nbands;
unsigned int ∗bins, ∗data;
int i, total_entries;
nbands = xil_histogram_get_nbands (histogram);
bins = (unsigned int∗) malloc(nbands ∗ sizeof(unsigned int));
xil_histogram_get_nbins (histogram, bins);
total_entries = 1;
for (i=0; i<nbands; i++)
total_entries ∗= bins[i];
data = (unsigned int∗) malloc(total_entries ∗ sizeof(unsigned int));
xil_histogram_get_values(histogram, data);

SEE ALSO

xil_histogram(3), xil_histogram_create(3), xil_histogram_destroy(3). 
 
 

SunOS 5.6  —  Last change: 17 August 1993

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