-
Notifications
You must be signed in to change notification settings - Fork 24
/
main.py
71 lines (63 loc) · 1.53 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# coding: utf-8
import argparse
import image
import naivefusion
import laplacianfusion
# Loading the arguments
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
'-l',
'--list',
dest='names',
type=str,
default='list_images.txt',
help='The text file which contains the names of the images')
parser.add_argument(
'-f',
'--folder',
dest='folder',
type=str,
required=True,
help='The folder containing the images')
parser.add_argument(
'-hp',
'--heightpyr',
dest='height_pyr',
type=int,
default=6,
help='The height of the Laplacian pyramid')
parser.add_argument(
'-wc',
dest='w_c',
type=float,
default=1.0,
help='Exponent of the contrast')
parser.add_argument(
'-ws',
dest='w_s',
type=float,
default=1.0,
help='Exponent of the saturation')
parser.add_argument(
'-we',
dest='w_e',
type=float,
default=1.0,
help='Exponent of the exposedness')
args = parser.parse_args()
params = vars(args) # convert to ordinary dict
names = [line.rstrip('\n') for line in open(params['names'])]
folder = params['folder']
height_pyr = params['height_pyr']
w_c = params['w_c']
w_s = params['w_s']
w_e = params['w_e']
# Naive Fusion
W = naivefusion.WeightsMap(folder, names)
res_naive = W.result_exposure(w_c, w_s, w_e)
image.show(res_naive)
# Laplacian Fusion
lap = laplacianfusion.LaplacianMap(folder, names, n=height_pyr)
res_lap = lap.result_exposure(w_c, w_s, w_e)
image.show(res_lap)