Update onnx_text_recognition.py
Browse files- onnx_text_recognition.py +1 -1
onnx_text_recognition.py
CHANGED
@@ -43,7 +43,7 @@ class TextRecognition:
|
|
43 |
def crop_line(self, image, polygon, height, width):
|
44 |
"""Crops predicted text line based on the polygon coordinates
|
45 |
and returns binarised text line image."""
|
46 |
-
|
47 |
rect = cv2.boundingRect(polygon)
|
48 |
cropped_image = image[rect[1]: rect[1] + rect[3], rect[0]: rect[0] + rect[2]]
|
49 |
mask = np.zeros([rect[3], rect[2]], dtype=np.uint8)
|
|
|
43 |
def crop_line(self, image, polygon, height, width):
|
44 |
"""Crops predicted text line based on the polygon coordinates
|
45 |
and returns binarised text line image."""
|
46 |
+
polygon = np.array([[int(lst[0]), int(lst[1])] for lst in polygon], dtype=np.int32)
|
47 |
rect = cv2.boundingRect(polygon)
|
48 |
cropped_image = image[rect[1]: rect[1] + rect[3], rect[0]: rect[0] + rect[2]]
|
49 |
mask = np.zeros([rect[3], rect[2]], dtype=np.uint8)
|