-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchanger.py
41 lines (27 loc) · 1.09 KB
/
changer.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
#!/usr/bin/env python
"""
This python file is created for change hue of the images
use min max and path arguments to specify your demanded.
"""
import argparse
import huechanger
import cv2
from cv2 import COLOR_BGR2RGB, COLOR_RGB2BGR
__author__ = "Orcun Gumus"
parser = argparse.ArgumentParser()
parser.add_argument('--path', dest='path', type=str, help='Input file path')
parser.add_argument('--opath', dest='opath', type=str, help='Output file paht')
parser.add_argument('--min', dest='min', type=int, help='360 degree min HUE')
parser.add_argument('--max', dest='max', type=int, help='360 degree max HUE')
parser.add_argument('--sat_min', dest='sat_min', type=int, help='360 degree min HUE')
parser.add_argument('--sat_max', dest='sat_max', type=int, help='360 degree min HUE')
args = parser.parse_args()
min = args.min
max = args.max
sat_min = args.sat_min
sat_max = args.sat_max
t = cv2.imread(args.path)
t = cv2.cvtColor(t, COLOR_BGR2RGB)
new_image = huechanger.change_in_range(t, min, max, sat_min, sat_max)
new_image = cv2.cvtColor(new_image, COLOR_RGB2BGR)
cv2.imwrite(args.opath, new_image)