medpy.metric.histogram.histogram_intersection#

medpy.metric.histogram.histogram_intersection(h1, h2)[source]#

Calculate the common part of two histograms.

The histogram intersection between two histograms \(H\) and \(H'\) of size \(m\) is defined as:

\[d_{\cap}(H, H') = \sum_{m=1}^M\min(H_m, H'_m)\]

Attributes:

  • a real metric

Attributes for normalized histograms:

  • \(d(H, H')\in[0, 1]\)

  • \(d(H, H) = 1\)

  • \(d(H, H') = d(H', H)\)

Attributes for not-normalized histograms:

  • not applicable

Attributes for not-equal histograms:

  • not applicable

Parameters:
h1sequence

The first histogram, normalized.

h2sequence

The second histogram, normalized, same bins as h1.

Returns:
histogram_intersectionfloat

Intersection between the two histograms.