forked from TeamHG-Memex/imageSimilarity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunSample.py
36 lines (28 loc) · 1.4 KB
/
runSample.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from PIL import Image
from glob import glob
from imageSimilarity import ImageSimilarity
from random import shuffle
if __name__ == '__main__':
origImageFiles = glob("/Users/hopperj/work/hyperionGray/catsImageDistortion/images/original/*")
rotatedImageFiles = glob("/Users/hopperj/work/hyperionGray/catsImageDistortion/images/rotated/*")
resizedImageFiles = glob("/Users/hopperj/work/hyperionGray/catsImageDistortion/images/resized/*")
croppedImageFiles = glob("/Users/hopperj/work/hyperionGray/catsImageDistortion/images/cropped/*")
croppedResizedImageFiles = glob("/Users/hopperj/work/hyperionGray/catsImageDistortion/images/cropped_resized/*")
nosiyImageFiles = glob("/Users/hopperj/work/hyperionGray/catsImageDistortion/images/noisy/*")
allDistortedImages = {
"rotated":rotatedImageFiles,
"resized":resizedImageFiles,
"cropped":croppedImageFiles,
"croppedResized":croppedResizedImageFiles,
"nosiy":nosiyImageFiles,
}
imgSim = ImageSimilarity(origImageFiles)
for name, distortedSet in allDistortedImages.items():
imgSim.resetScores()
for imgFile in distortedSet[:100]:
imgSim.scoreImage( Image.open(imgFile) )
print("\n\n--------------")
print(name)
print("Totals:",str(imgSim.getTotalScores()))
print("Hash Scores:",imgSim.getIndividualHashScores())
print("--------------")