Distance functions

This module supports functions to calculate the distance between two vectors.


chebychev

pysptools.distance.chebyshev(s1, s2)

Computes the chebychev distance between two vector.

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

NormXCorr

pysptools.distance.NormXCorr(s1, s2)

Computes the normalized cross correlation distance between two vector.

Parameters:
s1: numpy array
The first vector.
s2: numpy 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.

SAM

pysptools.distance.SAM(s1, s2)

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

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

SID

pysptools.distance.SID(s1, s2)

Computes the spectral information divergence between two vectors.

Parameters:
s1: numpy array
The first vector.
s2: numpy 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.