-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
45 lines (35 loc) · 1.63 KB
/
main.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
37
38
39
40
41
42
43
44
45
import cv2
import numpy as np
import packages.dcci as dcci
import img_resources as imr
# Init
window_name = "UpScaling"
N = 1 # 2^N scaling
# timg = np.zeros((7,7), dtype=np.uint8) +255
# timg[2:-2:2,2:-2:2] = 0
# timg = np.array([[255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
# [255, 255, 255, 255, 0, 255, 0, 255, 255, 255, 255],
# [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
# [255, 255, 255, 0, 255, 0, 255, 0, 255, 255, 255],
# [255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255],
# [255, 255, 255, 0, 0, 0, 0, 0, 255, 255, 255],
# [255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255],
# [255, 255, 255, 0, 255, 0, 255, 0, 255, 255, 255],
# [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255],
# [255, 255, 255, 255, 0, 255, 0, 255, 255, 255, 255],
# [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255]], dtype=np.uint8)
# for imgT in [timg]:
# cv2.imshow(f"{window_name}", dcci.Dcci(imgT))
# cv2.waitKey(0)
# cv2.destroyAllWindows()
for file in imr.test_images[7:8]:
print(file)
imgT = cv2.imread(file, cv2.IMREAD_COLOR)
img = dcci.Dcci(imgT,N)
img2 = cv2.resize(imgT, (0,0), fx=2**N, fy=2**N, interpolation=cv2.INTER_CUBIC)
img2 = img2[:-(2**N-1),:-(2**N-1)]
b = np.uint8(np.zeros((img.shape[0],4,3)) + (0,0,255))
imgOut = np.concatenate((img,b,img2), axis=1)
cv2.imshow(f"{window_name} (DCCI : Bicubic)- {file}", imgOut)
cv2.waitKey(0)
cv2.destroyAllWindows()