From ba79af1b164072bb098c292d8fdde317306bc0d6 Mon Sep 17 00:00:00 2001 From: Vedrana KRIVOKUCA Date: Thu, 19 Oct 2017 10:07:11 +0200 Subject: [PATCH] Improve documentation in HammingDistance class --- bob/bio/vein/algorithm/HammingDistance.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bob/bio/vein/algorithm/HammingDistance.py b/bob/bio/vein/algorithm/HammingDistance.py index 3ce7729..cfa5c29 100644 --- a/bob/bio/vein/algorithm/HammingDistance.py +++ b/bob/bio/vein/algorithm/HammingDistance.py @@ -7,9 +7,22 @@ import scipy.spatial.distance class HammingDistance (Distance): - """Finger vein matching: Hamming Distance between binary fingervein feature vectors + """This class calculates the Hamming distance between two binary images. + + Each binary image is first flattened by concatenating its rows to form a one-dimensional vector. The Hamming distance is then calculated between the two binary vectors. + The Hamming distance is computed using :py:func:`scipy.spatial.distance.hamming`, which returns a scalar ``float`` to represent the proportion of mismatching corresponding bits between the two binary vectors. + + **Parameters:** + + ``distance_function`` : function + Set this parameter to ``scipy.spatial.distance.hamming`` to ensure we are calculating the Hamming distance + + ``is_distance_function`` : bool + Set this flag to ``False`` to ensure that Hamming distances are returned as positive values rather than negative + """ + def __init__( self, distance_function = scipy.spatial.distance.hamming, -- 2.21.0