forked from dongb5/Retinex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
52 lines (42 loc) · 1.02 KB
/
run.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
import sys
import os
import cv2
import json
import retinex
data_path = 'data'
img_list = os.listdir(data_path)
if len(img_list) == 0:
print 'Data directory is empty.'
exit()
with open('config.json', 'r') as f:
config = json.load(f)
for img_name in img_list:
if img_name == '.gitkeep':
continue
img = cv2.imread(os.path.join(data_path, img_name))
img_msrcr = retinex.MSRCR(
img,
config['sigma_list'],
config['G'],
config['b'],
config['alpha'],
config['beta'],
config['low_clip'],
config['high_clip']
)
img_amsrcr = retinex.automatedMSRCR(
img,
config['sigma_list']
)
img_msrcp = retinex.MSRCP(
img,
config['sigma_list'],
config['low_clip'],
config['high_clip']
)
shape = img.shape
cv2.imshow('Image', img)
cv2.imshow('retinex', img_msrcr)
cv2.imshow('Automated retinex', img_amsrcr)
cv2.imshow('MSRCP', img_msrcp)
cv2.waitKey()