In an attempt to compare histograms of two segments, we'll employ a number of different techniques.

## Some Considerations

Some things to keep in mind, though, is that the information close to the center of the histogram (128) is more reliable than the information close to the edge (0, 255). Overexposure and underexposure could be the culprit, and everything matches when everything is black! One way to possibly combat this is to weight the center of the histogram more than the edge. A sine curve could work. As would a normal curve. This might need some exploration to find the appropriate weighting function.

For the examples below, let's assume that an ideal weighting function has been discovered; call it w(i). At the center of the histogram (128), it returns a number close to 1. At the ends, it returns a number close to 0.

Another part is changes in light. If an object comes under a shadow, the histogram will retain a similar shape, but lessen in strength. Normalizing the histogram will help.

Reflections could also cause potential problems.

It would be ideal to have a function that can compare the *color* qualities of two segments, disregarding the brightness.

## Simple Summing for Quantified Similarity and Dissimilarity

For the following equationsZ

- Let h
_{1}and h_{2}be discrete functions over the closed interval 0-255 returning a real number normally between 0 and 1. The first parameter indicates the index for an array of floats of a normalized (0-1) histogram channel. Note: the value returned could be outside the 0-1 range. - Let c be some really small constant (to avoid division by zero)

## Comparing the Slopes (Discrete Derivative)

This needs some more thought, but I think it has some promise. (see Discrete Calculus for more information).

(4)## Comparing Max

- let X1 be index of the global max for hist1, X2 be the index of the global max for hist2
- need to weight the difference by closeness to center, because if the global max sits at either end, that could be matching black (under exposed) and white (over exposed)… which could be bad