forked from prnvdixit/Pyfont
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
35 lines (27 loc) · 1.87 KB
/
main.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
import cv2
import argparse
import get_text
import fill_html
import operator
#################################################################################################################################
# _____ ______ _ #
# | __ \ | ____| | | #
# | |__) | _| |__ ___ _ __ | |_ #
# | ___/ | | | __/ _ \| '_ \| __| #
# | | | |_| | | | (_) | | | | |_ #
# |_| \__, |_| \___/|_| |_|\__| #
# _/ | #
# |___/ #
#################################################################################################################################
if __name__ == "__main__":
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
help="path to image to crop")
ap.add_argument("directory", help="path to font files")
args = vars(ap.parse_args())
image = cv2.imread(args["image"])
ocr_text = get_text.return_text(image)
#print(ocr_text)
error_values = fill_html.screenshot_html(args, ocr_text)
error_values_sort = sorted(error_values.items(), key=operator.itemgetter(1))
print(error_values_sort[:10])