-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (28 loc) · 872 Bytes
/
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
36
37
import os
import cv2
from matplotlib import pyplot as plt
from TextDetector import TextDetector
def load_images_from_folder(folder):
images = []
for filename in os.listdir(folder):
img = cv2.imread(os.path.join(folder, filename))
if img is not None:
images.append(img)
return images
images = load_images_from_folder("C:\\data\\test")
# images = load_images_from_folder("C:\\data\\multiple")
def makeSubplot(image, ax, key, colormap="gray", title=""):
ax[key].imshow(image, cmap=colormap)
ax[key].set_title(title)
ax[key].axis("off")
# loop over the input image paths
for image in images:
textDetector = TextDetector(
image,
# Comment line to disable option:
# show_process=True,
# show_segments=True,
show_result=True,
)
textDetector.detect_text()
plt.show()