-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathrecover.py
More file actions
30 lines (19 loc) · 728 Bytes
/
recover.py
File metadata and controls
30 lines (19 loc) · 728 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
29
30
import cv2
import scipy.io as sio
import numpy as np
from dehaze_patchMap_dehaze import dehaze_patchMap
hazy_img_dir = 'image/'
patchMap_dir = 'patchMap/'
save_dir = 'result/'
imgname= 'girls.tif'
image = cv2.imread(hazy_img_dir + imgname)
if image.shape[0] != 480 or image.shape[1] != 640:
print('resize image tp 640*480')
image = cv2.resize(image,(640,480))
print(imgname)
patchMapname = imgname[:-4] + '.mat'
patchMap = sio.loadmat(patchMap_dir + patchMapname)
patchMap = np.array(patchMap['patchMap'])
recover_result, tx = dehaze_patchMap(image, 0.95, patchMap)
savename_result = save_dir + 'py_recover_' + imgname
cv2.imwrite(savename_result, recover_result)