-
Notifications
You must be signed in to change notification settings - Fork 1
/
time.py
53 lines (36 loc) · 1.12 KB
/
time.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
46
47
48
49
50
51
52
53
import tonemap_and_bloom as tb
from timeit import timeit
import cv2 as cv
name = "mountain"
evs = [-1, 0, 1]
ext = "jpg"
kern_size = (55, 55)
num = 100
kernel = cv.imread("img/_flares/unreal1.jpg").astype('float64')
imgs = tb.get_images(name, evs, ext)
tone_mapped = tb.tone_mapping(imgs, 1, 1, 1)
bloom_overlay = tb.bloom(imgs[0], kernel, 2, kern_size)
print(imgs[0].shape[1], "x", imgs[0].shape[0], "x", len(evs))
print(kern_size[0], "x", kern_size[1])
tonemap = timeit(lambda: tb.tone_mapping(imgs, 1.0, 1.0, 1.0), number=num)
tonemap /= num
print("tonem: ", tonemap)
bloom = timeit(lambda: tb.bloom(imgs[0], kernel, 2.0, kern_size), number=num)
bloom /= num
print("bloom: ", bloom)
merge = timeit(lambda: tb.merge(tone_mapped, bloom_overlay, 1), number=num)
merge /= num
print("merge: ", merge)
total = timeit(lambda: tb.tonemap_and_bloom(
imgs=imgs,
kernel=kernel,
contrast_weight=1.0,
saturation_weight=1.0,
exposure_weight=1.0,
bloom_kernel_size=kern_size,
smoothing_factor=2.0,
bloom_intensity=1.0
), number=num)
total /= num
print("total: ", total)
print("calcu: ", tonemap+bloom+merge)