GPULib API

Tech-X Corporation

single page | use frames     summary     class     fields     routine details     file attributes

lib/

gpuhist_2d.pro


top gpuhist_2d

result = gpuhist_2d(im1, im2, MIN1=MIN1, MIN2=MIN2, MAX1=MAX1, MAX2=MAX2, BIN1=BIN1, BIN2=BIN2)

NAME: GPUHIST_2D

PURPOSE: Return the density function (histogram) of two variables.

CATEGORY: Image processing, statistics, probability.

CALLING SEQUENCE: Result = hist_2d(V1, V2) INPUTS: V1 and V2 = arrays containing the variables. May be any non-complex numeric type.

Keyword Inputs: MIN1: MIN1 is the minimum V1 value to consider. If this keyword is not specified, then if the smallest value of V1 is greater than zero, then MIN1=0 is used, otherwise the smallest value of V1 is used.

MIN2: MIN2 is the minimum V2 value to consider. If this keyword is not specified, then if the smallest value of V2 is greater than zero, then MIN2=0 is used, otherwise the smallest value of V2 is used.

MAX1: MAX1 is the maximum V1 value to consider. If this keyword is not specified, then V1 is searched for its largest value.

MAX2 MAX2 is the maximum V2 value to consider. If this keyword is not specified, then V2 is searched for its largest value.

BIN1 The size of each bin in the V1 direction (column width). If this keyword is not specified, the size is set to 1.

BIN2 The size of each bin in the V2 direction (row height). If this keyword is not specified, the size is set to 1.

OUTPUTS: The two dimensional density function of the two variables, a longword array of dimensions (m1, m2), where: m1 = Floor((max1-min1)/bin1) + 1 and m2 = Floor((max2-min2)/bin2) + 1 and Result(i,j) is equal to the number of sumultaneous occurences of an element of V1 falling in the ith bin, with the same element of V2 falling in the jth bin.

RESTRICTIONS: Not usable with complex or string data.

PROCEDURE: Creates a combines array from the two variables, equal to the linear subscript in the resulting 2D histogram, then applies the standard histogram function.

EXAMPLE: Return the 2D histogram of two byte images: R = HIST_2D(image1, image2)

Return the 2D histogram made from two floating point images with range of -1 to +1, and with 101 (= 2/.02 + 1) bins: f1 = RANDOMN(seed, 256, 256) f2 = RANDOMN(seed, 256, 256) R = HIST_2D(f1, f2, MIN1=-1, MIN2=-1, MAX1=1, MAX2=1, $ BIN1=.02, BIN2=.02) TVSCL, R

MODIFICATION HISTORY: Written by: DMS, Sept, 1992 Written DMS, Oct, 1995 Added MIN, MAX, BIN keywords following suggestion of Kevin Trupie, GSC, NASA/GSFC. CT, RSI, May 2001: Corrected MIN, MAX keywords so that the out-of-range values are ignored rather than truncated to be within range. Allow input arrays with negative values.

Parameters

im1
im2

Keywords

MIN1
MIN2
MAX1
MAX2
BIN1
BIN2

File attributes

Modification date: Fri Nov 12 11:07:45 2010
Lines: 153