-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeblue.py
29 lines (19 loc) · 715 Bytes
/
deblue.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
import cv2
import numpy as np
from simulate import Gassian
def deblue(img, output_path):
BGR = cv2.cvtColor(img,cv2.COLOR_GRAY2BGR)
HSV = cv2.cvtColor(BGR,cv2.COLOR_BGR2HSV)
size = img.shape
HSV[:,:,0]= Gassian(size, mean = 15, var = 1)
HSV[:,:,1]= Gassian(size, mean = 20, var = 2)
result = cv2.cvtColor(HSV,cv2.COLOR_HSV2BGR)
result = np.uint8(result)
cv2.imwrite(output_path+'/aging.jpg', result)
# cv2.imshow("aging",result)
# cv2.waitKey(0)
if __name__ == '__main__':
input_path = './output/draw.png'
output_path = './output'
input_img = cv2.imread(input_path, cv2.IMREAD_GRAYSCALE)
deblue(input_img, output_path)