Page MenuHomec4science

Anchor.py
No OneTemporary

File Metadata

Created
Mon, Nov 4, 03:32

Anchor.py

import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import glob
path = r'C:\Users\srpv\Desktop\Publication Ready\DED\Code\Folder_Siamese\Data\2' # use your path
all_files = glob.glob(path + "/*.png")
ims = []
for filename in all_files:
print(filename)
ims.append(Image.open(filename, mode='r'))
ims = np.array([np.array(im) for im in ims])
imave = np.average(ims,axis=0)
print(imave.shape)
result = Image.fromarray(imave.astype('uint8'))
result.save('C:/Users/srpv/Desktop/Publication Ready/DED/Code/Folder_Siamese/Anchor/Normal/result.png')
plt.figure(figsize=(20,4))
plt.imshow(np.transpose(result, (0, 1, 2)))

Event Timeline