Traceback (most recent call last):
File "/Users/user/ssim.py", line 49, in <module>
ssim = calc_closest_val(ssim_measures, True)
File "/Users/user/ssim.py, line 36, in calc_closest_val
closest = max(my_dict.values())
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
...
...
def calc_closest_val(my_dict, checkMax):
result = {}
if (checkMax):
closest = max(my_dict.values())
else:
closest = min(my_dict.values())
for key, value in my_dict.items():
print("The difference between ", key ," and the original image is : \n", value)
if (value == closest):
result[key] = closest
...
...
import sys
from PIL import Image
img2 = cv2.imread(sys.argv[1])
img1 = cv2.imread(sys.argv[2])
im1 = Image.open(sys.argv[1])
im2 = Image.open(sys.argv[2])
im1.paste(im2.convert('RGB'), (0,0), im2)
im1.save('r2.png')
Вывод выглядит так: