imagehash.average_hash results in array instead of string
See original GitHub issueUsing python 2.7, when I try:
`from PIL import Image
import imagehash
img = Image.open(path)
hash = imagehash.average_hash(img)
print ("hash is:", hash)`
The result is an array like this:
('hash is:', array([[False, False, False, True, False, False, True, True], [False, False, False, True, True, True, True, True], [False, True, False, True, True, True, True, True], [False, True, True, True, True, True, True, True], [False, True, True, True, False, True, False, False], [False, True, True, True, True, True, True, False], [False, False, True, False, False, False, True, False], [False, False, False, False, False, False, True, True]])
Instead of a string. What I’m missing here? How can I fix it?
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
python 3.x - Numpy error trying to use difference hashing with ...
I am trying to perform difference hashing with the python ImageHash library and keep getting a numpy error. The error ...
Read more >Image hashing with OpenCV and Python - PyImageSearch
This tutorial covers how to perform image hashing and perceptual hashing using computer vision and image processing via OpenCV and Python.
Read more >ImageHash - PyPI
An image hashing library written in Python. ImageHash supports: Average hashing. Perceptual hashing. Difference hashing. Wavelet hashing.
Read more >Looks Like It - The Hacker Factor Blog
As with the Average Hash, pHash values can be compared using the same Hamming distance algorithm. (Just compare each bit position and count ......
Read more >Hashing - Imagededup
image_array : Optional, used instead of image_file. Image typecast to numpy array. Returns. hash: A 16 character hexadecimal string hash for the image....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This works fine on an stand-alone python file. But as I need to save
hash
to mysql database, so that the comparison can be done later. And there started the problem.well if we look at https://github.com/JohannesBuchner/imagehash/blob/master/imagehash/__init__.py we find
def hex_to_hash(hexstr)
which takes a string and gives you a hash object. Then you should be able to compute the distance as normal, afaik.