-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget_letter_parts.py
28 lines (21 loc) · 1.06 KB
/
get_letter_parts.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
# For each file in the given dataset, identify the different parts of the letter and save it in the contours directory')
import os
import argparse
import letter_image as li
parser = argparse.ArgumentParser(description='For each letter image in dataset_dir, identify the different parts of the letter and save it in the contours directory')
parser.add_argument('-d', '--dataset', required=False,
help='dataset directory containing the letter images',
default= "/media/datadr/datasets/letters")
parser.add_argument('-s', '--savedir', required=False,
help='directory where the letter parts are saved',
default= "contours")
args = parser.parse_args()
dataset_dir = args.dataset
savedir_name = args.savedir
if not(os.path.isdir(savedir_name)):
os.makedirs(savedir_name)
for file in os.listdir(dataset_dir):
print("processing",file)
letter_obj = li.letter_image(dataset_dir, file)
letter_obj.process_letter()
letter_obj.display_contours(display=False,save=True,savedir='contours')