-
Notifications
You must be signed in to change notification settings - Fork 3
/
example_ami_ocr.py
55 lines (40 loc) · 1.28 KB
/
example_ami_ocr.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from pyamiimage.ami_ocr import TextBox, AmiOCR
from test.resources import Resources
from skimage import io
biosynth2 = Resources.BIOSYNTH2
biosynth2_img = io.imread(biosynth2)
biosynth2_ocr = AmiOCR(biosynth2)
med_xrd = Resources.MED_XRD_FIG_A_LABELS
med_xrd_img = io.imread(med_xrd)
med_xrd_ocr = AmiOCR(med_xrd)
# words = biosynth2_ocr.get_words()
# # biosynth2_ocr.find_baseline()
# for word in words:
# print(word)
# phrases = biosynth2_ocr.get_phrases()
# for phrase in phrases:
# print(phrase)
# # biosynth2_img_bboxes = AmiOCR.plot_bboxes_on_image(biosynth2_img, words)
# # io.imshow(biosynth2_img_bboxes)
# # io.show()
# biosynth2_img_bboxes = AmiOCR.plot_bboxes_on_image(biosynth2_img, phrases)
# io.imshow(biosynth2_img_bboxes)
# io.show()
# # groups = biosynth2_ocr.get_groups()
# # for group in groups:
# # print(group)
words = med_xrd_ocr.get_words()
for word in words:
print(word)
phrases = med_xrd_ocr.get_phrases()
for phrase in phrases:
print(phrase)
# biosynth2_img_bboxes = AmiOCR.plot_bboxes_on_image(biosynth2_img, words)
# io.imshow(biosynth2_img_bboxes)
# io.show()
med_xrd_img_bboxes = AmiOCR.plot_bboxes_on_image(med_xrd_img, words)
io.imshow(med_xrd_img_bboxes)
io.show()
# groups = biosynth2_ocr.get_groups()
# for group in groups:
# print(group)