diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2019-04-14 19:52:16 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2019-04-14 19:52:16 +0200 |
| commit | 61f169d109c9ba1c01ada06d830973c873d4e634 (patch) | |
| tree | 8ec603eaa0e10332367fc9c4bef085db2b18c06a /check/app/utils | |
| parent | 0a4b3ea4611fcbe66b148041f82e77a0f138e688 (diff) | |
record format
Diffstat (limited to 'check/app/utils')
| -rw-r--r-- | check/app/utils/im_utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/check/app/utils/im_utils.py b/check/app/utils/im_utils.py index 3002632..eae7bc1 100644 --- a/check/app/utils/im_utils.py +++ b/check/app/utils/im_utils.py @@ -208,6 +208,16 @@ def compute_phash(im): """ return imagehash.phash(ensure_pil(im)) +def compute_phash_int(im): + """Compute perceptual hash using ImageHash library and convert to binary + :param im: Numpy.ndarray + :returns: ImageHash as binary + """ + phash = imagehash.phash(ensure_pil(im)) + phash.hash[-1] = False + phash_as_bigint = struct.unpack('Q', numpy.packbits(phash.hash))[0] + return phash_as_bigint + def compute_dhash(im): """Compute difference hash using ImageHash library :param im: Numpy.ndarray |
