-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_cmd.py
More file actions
76 lines (65 loc) · 1.72 KB
/
create_cmd.py
File metadata and controls
76 lines (65 loc) · 1.72 KB
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
72
73
74
75
76
# -*- coding: utf-8 -*-
"""
Script de création des lignes de commande pour appliquer des courbes à un ensemble d'images
"""
import argparse
import os
def read_args():
"""Gestion des arguments"""
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", required=True, help="input data folder")
parser.add_argument("-o", "--output", required=True, help="output data folder")
parser.add_argument(
"-c", "--curve", required=True, help="param file for images and curves"
)
parser.add_argument(
"-a", "--acv", required=True, help="path of folder containing acv files"
)
parser.add_argument(
"-f",
"--file",
required=False,
help="output file containing command lines (cmd.txt)",
default="cmd.txt",
)
parser.add_argument(
"-b",
"--blocksize",
help="number of lines per block",
default=1000
)
parser.add_argument(
"-q",
"--quality",
help="JPEG Compression quality (100: No compression)",
default=90
)
parser.add_argument(
"-v", "--verbose", help="verbose (default: 0)", type=int, default=0
)
args = parser.parse_args()
if args.verbose >= 1:
print("\nArguments: ", args)
return args
args = read_args()
fOut = open(args.file, "w")
cwd = os.getcwd()
pathApplyAcv = cwd+"\\apply_acv.py"
for line in open(args.curve):
fOut.write(
"python "
+ pathApplyAcv
+ " -i "
+ args.input
+ " -o "
+ args.output
+ " -a "
+ args.acv
+ " -b "
+ str(args.blocksize)
+ " -q "
+ str(args.quality)
+ " -c "
+ line
)
fOut.close()