Distance Functions

This module supports functions to calculate the distance between two vectors. These distances are supported:

Chebychev

pysptools.distance.chebyshev(s1, s2)[source]

Computes the chebychev distance between two vector.

Parameters:
  • s1numpy array The first vector.
  • s2numpy array The second vector.
Returns: float
Chebychev distance between s1 and s2.

Normalized Cross Correlation (NormXCorr)

pysptools.distance.NormXCorr(s1, s2)[source]

Computes the normalized cross correlation distance between two vector.

Parameters:
  • s1numpy array The first vector.
  • s2numpy array The second vector.
Returns: float
NormXCorr distance between s1 and s2, dist is between [-1, 1]. A value of one indicate a perfect match.

Spectral Angle Mapper (SAM)

pysptools.distance.SAM(s1, s2)[source]

Computes the spectral angle mapper between two vectors (in radians).

Parameters:
  • s1numpy array The first vector.
  • s2numpy array The second vector.
Returns: float
The angle between vectors s1 and s2 in radians.

Spectral Information Divergence (SID)

pysptools.distance.SID(s1, s2)[source]

Computes the spectral information divergence between two vectors.

Parameters:
  • s1numpy array The first vector.
  • s2numpy array The second vector.
Returns: float
Spectral information divergence between s1 and s2.
Reference
C.-I. Chang, “An Information-Theoretic Approach to SpectralVariability, Similarity, and Discrimination for Hyperspectral Image” IEEE TRANSACTIONS ON INFORMATION THEORY, VOL. 46, NO. 5, AUGUST 2000.