-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_k-svd.py
executable file
·33 lines (25 loc) · 993 Bytes
/
run_k-svd.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
#!/usr/bin/env python3
import argparse
import os
# parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("add_noise", type=str, default="True")
ap.add_argument("sigma", type=int)
ap.add_argument("speedup", type=str, default="False")
ap.add_argument("computebias", type=str, default="False")
ap.add_argument("dobestpsnr", type=str, default="False")
args = ap.parse_args()
def get_bool_param_from_string(string):
"""
Returns 1 (True) or 0 (False) from the string value
"""
test = str(string)
param = 1 if test == 'True' else 0
return param
noise = get_bool_param_from_string(args.add_noise)
speedup = get_bool_param_from_string(args.speedup)
computebias = get_bool_param_from_string(args.computebias)
dobestpsnr = get_bool_param_from_string(args.dobestpsnr)
p = f'ksvd input_0.png {args.sigma} {noise} noisy.png denoised.png diff.png bias.png diff_bias.png {computebias} {speedup} {dobestpsnr}'
os.system(p)
if os.system(p)!= 0: exit(-1)