# CompareHistogram3D

The CompareHistogram3D function is used to compare two 3D histograms (existing in the spreadsheet as Histogram3D structures) in terms of their distribution of frequencies. When using the function, consider the following factors:

- To make sense of the comparison, Cognex recommends to compare histograms with similar configuration parameters (such as similar Bin and Subsample Sizes, or similar Minimum and Maximum values). Otherwise, the comparison percentage returned by the function will not reflect the similarity of the two object surfaces associated with the compared histograms.

- Regardless of the configured Bin Size, the number of bins must be the same in the compared histograms. If the number of bins are different, the function returns the Different Number of Bins error message.

## CompareHistogram3D Inputs

The CompareHistogram3D function has the following syntax:

CompareHistogram3D(PointCloud,ExternalHistogram0,ExternalHistogram1)

See the table for a description of the available parameters.

Parameter | Description
PointCloud | Reference to a cell containing a point cloud. The default value is $A$0.
External Histogram 0 | Specifies a reference to the first Histogram3D structure created in another cell to be used for comparison.
External Histogram 1 | Specifies a reference to the second Histogram3D structure created in another cell to be used for comparison.

## CompareHistogram3D Outputs

Returns | The similarity percentage of the compared histograms, as an integer.
Results | When initially inserted into a cell, the function either returns an integer with a value range of 0 – 100 (standing for the similarity percentage), or #ERR if the function encountered any issues (such as a different number of bins in the two histograms).