Browse Source

minor update on image hash funcs, return str instead of int

quarrying 3 years ago
parent
commit
74f7dbfb3e
1 changed files with 3 additions and 3 deletions
  1. 3 3
      khandy/image/image_hash.py

+ 3 - 3
khandy/image/image_hash.py

@@ -26,7 +26,7 @@ def calc_image_ahash(image):
     mean_val = np.mean(resized)
     hash_mat = resized >= mean_val
     hash_val = _convert_bool_matrix_to_int(hash_mat)
-    return hash_val
+    return f'{hash_val:016x}'
     
     
 def calc_image_dhash(image):
@@ -42,7 +42,7 @@ def calc_image_dhash(image):
     
     hash_mat = resized[:,:-1] >= resized[:,1:]
     hash_val = _convert_bool_matrix_to_int(hash_mat)
-    return hash_val
+    return f'{hash_val:016x}'
     
     
 def calc_image_phash(image):
@@ -66,5 +66,5 @@ def calc_image_phash(image):
 
     hash_mat = reduced_dct_coeff >= median_val
     hash_val = _convert_bool_matrix_to_int(hash_mat)
-    return hash_val
+    return f'{hash_val:016x}'