How to use the imagehash.similarity function in ImageHash

To help you get started, we’ve selected a few ImageHash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cbanack / comic-vine-scraper / src / py / utils / automatcher.py View on Github external
def are_the_same(hash1, hash2):
      x = imagehash.similarity(hash1, hash2)
      return x > __MATCH_THRESHOLD
github cbanack / comic-vine-scraper / src / py / utils / automatcher.py View on Github external
if secondary:
            series_refs.remove(secondary)
            tertiary = find_best_score(series_refs)
      
      # 3. if our book is the first (or unknown) issue, figure out if the best  
      #    matching series has a similar cover to the second or third best.
      #    if it does, we're probably dealing with a trade paperback and a 
      #    regular issue, and we can't find the best series reliably, so we bail
      is_first_issue = (lambda i : not i or \
         (utils.is_number(i) and float(i)==1.0))(book.issue_num_s)
      if is_first_issue and primary and secondary:
         too_similar = False
         SIMILARITY_THRESHOLD = __MATCH_THRESHOLD - 0.10
         hash1 = __get_remote_hash(primary)
         hash2 = __get_remote_hash(secondary)
         if imagehash.similarity(hash1, hash2) > SIMILARITY_THRESHOLD:
            too_similar = True
         elif tertiary:
            hash3 = __get_remote_hash(tertiary)
            if imagehash.similarity(hash1, hash3) > SIMILARITY_THRESHOLD:
               too_similar = True
         primary = None if too_similar else primary
      
   return primary
github cbanack / comic-vine-scraper / src / py / utils / automatcher.py View on Github external
# 3. if our book is the first (or unknown) issue, figure out if the best  
      #    matching series has a similar cover to the second or third best.
      #    if it does, we're probably dealing with a trade paperback and a 
      #    regular issue, and we can't find the best series reliably, so we bail
      is_first_issue = (lambda i : not i or \
         (utils.is_number(i) and float(i)==1.0))(book.issue_num_s)
      if is_first_issue and primary and secondary:
         too_similar = False
         SIMILARITY_THRESHOLD = __MATCH_THRESHOLD - 0.10
         hash1 = __get_remote_hash(primary)
         hash2 = __get_remote_hash(secondary)
         if imagehash.similarity(hash1, hash2) > SIMILARITY_THRESHOLD:
            too_similar = True
         elif tertiary:
            hash3 = __get_remote_hash(tertiary)
            if imagehash.similarity(hash1, hash3) > SIMILARITY_THRESHOLD:
               too_similar = True
         primary = None if too_similar else primary
      
   return primary

ImageHash

Image Hashing library

BSD-2-Clause
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis

Similar packages