-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddImages.py
More file actions
28 lines (26 loc) · 774 Bytes
/
addImages.py
File metadata and controls
28 lines (26 loc) · 774 Bytes
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
import numpy as np
from PIL import Image, ImageEnhance
from glob import glob
from matplotlib import pyplot as plt
from sklearn.preprocessing import normalize
files =glob('frames/frame*.png')
images=[]
for f in files:
im=Image.open(f)
enhancer = ImageEnhance.Contrast(im)
factor = 0.75 # increase contrast
im = enhancer.enhance(factor)
enhancer = ImageEnhance.Sharpness(im)
factor = 4
im = enhancer.enhance(factor)
# enhancer = ImageEnhance.Brightness(im)
# factor = 1.25 # brightens the image
# im = enhancer.enhance(factor)
# plt.imshow(im)
# plt.show()
images.append(np.array(im).astype(np.float32))
images=np.stack(images)
image=np.sum(images,axis=0)
image/=len(images)
plt.imshow(image.astype(np.uint8))
plt.show()