Skip to content

Commit

Permalink
Fixed and improved
Browse files Browse the repository at this point in the history
  • Loading branch information
jekil committed Oct 19, 2015
1 parent 425e235 commit 9c6ca62
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions plugins/processing/perceptualimagehash.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ def get_similar_images(self, hash_value, hash_func):

# Search.
image_hash = imagehash.hex_to_hash(hash_value)
similarities = set()
for img in self.task.case.images.all():
if img.state == "C" and img.report and \
similarities = list()
for img in self.task.case.images.filter(state="C").exclude(id=self.task.id):
if img.report and \
"imghash" in img.report and \
hash_name in img.report["imghash"] and \
image_hash == imagehash.hex_to_hash(img.report["imghash"][hash_name]):
similarities.add(self.task.id)
return list(similarities)
# TODO: store also image distance.
similarities.append(img.id)
return similarities


def run(self, task):
self.task = task
Expand Down

0 comments on commit 9c6ca62

Please sign in to comment.