AI Glossary / Computer vision and multimodal AI / Advanced

Bhattacharyya distance

Definition

Bhattacharyya distance measures dissimilarity between probability distributions by taking the negative logarithm of their Bhattacharyya coefficient, a measure of overlap. Identical distributions have distance zero, while distributions with less overlap have larger values.

What it means

A vision system may represent an image region by a normalized color histogram. Comparing two such histograms asks how similarly their probability mass is distributed across the same bins, rather than whether individual pixels occupy the same positions.

Bhattacharyya distance is useful for this kind of distribution comparison. It is symmetric: exchanging the two distributions does not change the value. Despite its name, it is not generally a metric because it does not satisfy every metric property, including the triangle inequality.

The result concerns the chosen representation. Two images can share a color distribution while showing different objects or layouts. A small histogram distance is therefore evidence of distributional similarity, not proof of semantic identity.

How it works

For discrete distributions p and q over matching categories, the coefficient is BC = sum over i of sqrt(pi qi). For normalized nonnegative probabilities, it lies between zero and one. The distance is DB = −ln(BC), using the natural logarithm in the conventional definition.

For continuous distributions, an integral replaces the sum. Particular distribution families can have closed-form expressions. If the distributions have disjoint support, the coefficient is zero and the logarithmic distance is infinite.

Practical calculations must align bins, normalize consistently and handle numerical limits. Some software uses the name Bhattacharyya for a related transformed coefficient, such as a Hellinger-style distance, rather than the negative-log form. Check the documented equation before comparing thresholds or results across implementations.

Three practical examples

  • A tracking method compares the color histogram of a candidate region with a reference object's histogram.
  • A data-monitoring workflow compares distributions of a selected image feature across capture sessions.
  • A pattern-recognition study evaluates how strongly class-conditional feature distributions overlap under an assumed statistical model.

Think of it this way

Think of two allocation charts that distribute a budget across the same categories. If both allocate money to similar categories in similar proportions, they overlap strongly. The analogy is limited: Bhattacharyya overlap uses square-root products of probabilities, not the minimum of two budget amounts, and it ignores information absent from the chosen categories.

Worked example

Let p = (0.8, 0.2) and q = (0.2, 0.8). The coefficient is sqrt(0.8 × 0.2) + sqrt(0.2 × 0.8) = 0.4 + 0.4 = 0.8. The distance is −ln(0.8), approximately 0.2231.

If q instead equals p, the coefficient is 0.8 + 0.2 = 1 and the distance is zero. If p = (1, 0) and q = (0, 1), there is no overlap, giving coefficient zero and infinite negative-log distance.

These examples use normalized two-bin distributions. They do not supply a universal threshold for deciding whether two real images match. That threshold would depend on the features, estimation uncertainty and consequences of an incorrect decision.

Illustrative case study

Fictional example: Colourpath Lab tracks a bright package using a reference color histogram. Several candidate regions are compared using a documented negative-log Bhattacharyya distance.

The team notices that another package with similar colors also receives a low distance. It adds spatial and motion evidence rather than treating histogram similarity as identity. Lighting changes are included in the test set because they can shift the same package's color distribution.

Engineers record the histogram bins and normalization along with the distance definition. This fictional case illustrates representation limits and reproducibility; it does not claim a measured tracking accuracy or a threshold suitable for every scene.

Common misconceptions and mistakes

The distance is not a probability that two samples come from different sources. It is a numerical divergence between the estimated distributions. A value near zero may reflect genuinely similar populations or a representation too coarse to distinguish them.

Different histogram binning can change the value. Zero-count bins can reflect finite sampling rather than truly impossible events, and smoothing such bins changes the estimated distributions. Symmetry does not make the distance a metric. Finally, the negative-log form should not be confused with the coefficient itself: larger coefficients indicate more overlap, while larger distances indicate less overlap.

Business use

This measure can provide a compact comparison for image features, statistical monitoring and model analysis. Its usefulness depends on whether the selected distributions preserve information relevant to the decision.

Document the feature definition, binning, normalization and exact formula. Calibrate any operational threshold using representative examples and estimate the impact of finite sample sizes. Combine distributional similarity with other evidence when spatial structure or identity matters. Monitor changes in lighting and capture conditions so that a shift in the measurement process is not mistaken automatically for a change in the underlying object.

People also ask

Can Bhattacharyya distance be negative?

For properly normalized distributions under the standard formula, it is nonnegative. A negative result suggests a numerical or definition issue.

Is the coefficient the same as the distance?

No. The coefficient measures overlap; the conventional distance is its negative logarithm.

Does a zero distance mean two images are identical?

It means the compared distributions are identical under the chosen representation, not necessarily that the underlying images are pixel-identical or semantically equivalent.

Check your understanding

If the Bhattacharyya coefficient rises from 0.5 to 0.9, what happens to the conventional distance?

Answer: It decreases, because −ln(0.9) is smaller than −ln(0.5). The distributions have greater overlap under this comparison.

Related terms

  • Probability distribution
  • Bhattacharyya coefficient
  • Hellinger distance
  • histogram comparison
  • statistical divergence
  • feature representation
  • distribution overlap

Learn next

Calculate the coefficient and negative-log distance for several small probability vectors. Keep the categories fixed and confirm that each vector sums to one. Then compare results after changing histogram bin sizes, and inspect the exact formula used by a software library before adopting a threshold.

More in Computer vision and multimodal AI

  • Beier - Neely field warping - Beier - Neely field warping is an image-deformation method controlled by corresponding line segments.
  • Belief revision - Belief revision is the systematic change of a set of accepted statements when new information arrives, especially when that information conflicts with...
  • Bessel's correction - Bessel's correction replaces division by n with division by n − 1 when estimating a population variance from n observations using their sample mean.
  • Bicubic - Bicubic interpolation estimates image values between sampled locations using cubic functions in two dimensions.
  • Bidirectional similarity - Bidirectional similarity is an image-comparison objective that checks patch matches in both directions between a source and a result.
  • Bilateral filtering - Bilateral filtering is an edge-preserving smoothing method that weights neighboring pixels by both spatial closeness and similarity in value.

Sources

Nielsen and Boltz, The Burbea-Rao and Bhattacharyya centroids, original research discussion: https://arxiv.org/abs/1004.5049 Nielsen, Statistical Divergences between Densities of Truncated Exponential Families with Nested Supports: https://franknielsen.github.io/papers/entropy-24-00421-v2.pdf The probability vectors and tracking case are original illustrations. The article uses the negative-natural-log coefficient definition.

Previous: Between­subjects designs Next: Bi-tempered loss

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer