I am comparing the hash of the source image with the hashes stored in the DB (as strings). I have converted them to "ImageHash" type but am still getting the error "AttributeError: 'str' object has no attribute 'size'".
image ='img1.jpg'
img = Image.open(img)
src_whash = imagehash.whash(img)
def get_similarity_whash(hash1):
hash1=imagehash.ImageHash(hash1)`
return hash1-src_whash
whash_sim=list(map(get_similarity_whash, whashes)) # getting the error here
The type of src_whash variable is "imagehash.ImageHash" when checked with type(src_whash) and the type of "hash1" used in the function is also "imagehash.ImageHash". Can anyone please tell me what I am doing wrong when comparing a string-based hash with the freshly computed one? Thanks!
I am comparing the hash of the source image with the hashes stored in the DB (as strings). I have converted them to "ImageHash" type but am still getting the error "AttributeError: 'str' object has no attribute 'size'".
The type of src_whash variable is "imagehash.ImageHash" when checked with type(src_whash) and the type of "hash1" used in the function is also "imagehash.ImageHash". Can anyone please tell me what I am doing wrong when comparing a string-based hash with the freshly computed one? Thanks!