Histogram Functions

This palette contains histogram functions.

Note: An vi icon with yellow background means they work on color images. With gray background means they only work on single channel image. With half yellow and half gray background means they work on both color and single channel image. Others vi icon background are for either examples or high level vis. For controls descriptions, you need to go to the vi in LabVIEW, use help (ctrl+H) and move mouse over the controls to see them.


IVision_Create Histogram.vi

Creates histogram header.

Connector Pane

IVision_Create Histogram.vi


IVision_SetHistBinRange.vi

Set histogram bin ranges.

Connector Pane

IVision_SetHistBinRange.vi


IVision_CalcHistogram.vi

calculates the histogram of one or more single-channel images. The elements of a tuple that is used to increment a histogram bin are taken at the same location from the corresponding input images.

Connector Pane

IVision_CalcHistogram.vi


IVision_NormalizeHist.vi

normalizes the histogram bins by scaling them, such that the sum of the bins becomes equal to factor.

Connector Pane

IVision_NormalizeHist.vi


IVision_ClearHistogram.vi

sets all histogram bins to 0.

Connector Pane

IVision_ClearHistogram.vi


IVision_ReleaseHistogram.vi

Releases the histogram (header and the data).

Connector Pane

IVision_ReleaseHistogram.vi


IVision_GetHistValue.vi

Get the histogram bin value at the indexes.

Connector Pane

IVision_GetHistValue.vi


IVision_CompareHistogram.vi

compares two histograms using specified method and returns the comparison result.

Connector Pane

IVision_CompareHistogram.vi


IVision_ThresholdHist.vi

clears histogram bins that are below the specified level.

Connector Pane

IVision_ThresholdHist.vi


IVision_GetMinMaxHistValue.vi

finds the minimum and maximum histogram bins

 

Connector Pane

IVision_GetMinMaxHistValue.vi


IVision_HistProbDensity.vi

calculates the object probability density from the two histograms as:

histDens(I)=0 if hist1(I)==0

scale if hist1(I)!=0 && hist2(I)>hist1(I)

hist2(I)*scale/hist1(I) if hist1(I)!=0 && hist2(I)<=hist1(I)

So the destination histogram bins are within [0,scale).

 

Connector Pane

IVision_HistProbDensity.vi


IVision_CalcBackProj.vi

Calculates the back project of the histogram. For each tuple of pixels at the same position of all input single-channel images the function puts the value of the histogram bin, corresponding to the tuple, to the destination image. In terms of statistics, the value of each output image pixel is probability of the observed tuple given the distribution (histogram). For example, to find a red object in the picture, one may do the following:

1. Calculate a hue histogram for the red object assuming the image contains only this object. The histogram is likely to have a strong maximum, corresponding to red color.

2. Calculate back projection of a hue plane of input image where the object is searched, using the histogram. Threshold the image.

3. Find connected components in the resulting picture and choose the right component using some additional criteria, for example, the largest connected component.

Connector Pane

IVision_CalcBackProj.vi


IVision_MatchTemplateByHist.vi

This vi calculates back projection by comparing histograms of the source image patches with the given histogram. Taking measurement results from some image at each location over ROI creates an array img. These results might be one or more of hue, x derivative, y derivative, Laplacian filter, oriented Gabor filter, etc. Each measurement output is collected into its own separate image. The img image array is a collection of these measurement images. A multi-dimensional histogram hist is constructed by sampling from the img image array. The final histogram is normalized. The hist histogram has as many dimensions as the number of elements in img array.

Each new image is measured and then converted into an img image array over a chosen ROI. Histograms are taken from this img image in an area covered by a "patch" with anchor at center as shown in the picture below. The histogram is normalized using the parameter norm_factor so that it may be compared with hist. The calculated histogram is compared to the model histogram; hist uses the function cvCompareHist with the comparison method=method). The resulting output is placed at the location corresponding to the patch anchor in the probability image dst. This process is repeated as the patch is slid over the ROI. Iterative histogram update by subtracting trailing pixels covered by the patch and adding newly covered pixels to the histogram can save a lot of operations, though it is not implemented yet.

Connector Pane

IVision_MatchTemplateByHist.vi