forked from tmikonen/magic_card_detector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave_hash.py
38 lines (30 loc) · 977 Bytes
/
save_hash.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
import pickle
import argparse
import magic_card_detector as mcg
def makeHash(path, name):
card_detector = mcg.MagicCardDetector('./')
card_detector.read_and_adjust_reference_images(path)
hlist = []
for image in card_detector.reference_images:
image.original = None
image.clahe = None
image.adjusted = None
hlist.append(image)
with open(name, 'wb') as f:
pickle.dump(hlist, f)
def main():
"""
Python MTG Card hasher.
"""
# Add command line parser
parser = argparse.ArgumentParser(
description='Create the hash file of images.')
parser.add_argument('input_path',
help='path containing the images to be hashed')
parser.add_argument('name',
help='name of data file to create')
args = parser.parse_args()
#makeHash(args.input_path, args.name)
makeHash(args.input_path, args.name)
if __name__ == "__main__":
main()