DBImageHistogram()

  DBImageHistogram

Description

DBImageHistogram() is used to compute a histogram of an image with caller controlled binning.

Call Signature

int DBImageHistogram ( int/string filespec, int channel_num, int bin_count, int ptr histogram_array [, double first_bin, double bin_width [, int include_out_of_range [, int x_offset [, int y_offset, int x_size, int y_size] ] ] ] )

Return Value

int

The total number of pixels accumulated into the histogram.

Arguments

int/string filespec:

This can either be the handle returned by DBOpen(), or the name of an open file.

int channel_num:

Input channel number.

int bin_count:

The number of bins, or entries in the histogram (hist_array). For eight bit data this should normally be 256.

int ptr histogram_array:

The array into which the histogram counts will be accumulated. This must be at least bin_count values long.

[ double first_bin ]:

If this argument is present, this is the value corresponding to the first bin. If missing a default value of zero is assumed.

[ double bin_width ]:

If this argument is present, this is the width of each bin in image greylevel values. If missing a default value of 1.0 is used.

[ int include_out_of_range ]:

If this argument is present, this is a flag indicating whether values outside the binning range should be included in the closest bin (1) or not (0). If missing a default value of 0 is used.

[ int x_offset ]:

If the Arguments x_offset, y_offset, x_size, and y_size are missing, the entire channel is used. If only x_offset argument is provided, then it will be interpreted as a bitmap segment number to use as a mask. Otherwise, if x_offset is present this is the X offset to the first desired pixel on the requested scanline. This is zero for the very first pixel on the scanline.

[ int y_offset ]:

If this argument is present, this is the Y offset to the first desired scanline. This is zero for the very first scanline in the file.

[ int x_size ]:

If this argument is present, this is the width of a window of data in pixels.

[ int y_size ]:

If this argument is present, this is the height of a window of data in scanlines.

Remarks

Note, "y_offset, x_size, y_size" must either be all absent, or must include x_offset and be all present.

See also GDB file functions

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.