Change mask to same size as cropped_image
Browse files- onnx_text_recognition.py +1 -1
onnx_text_recognition.py
CHANGED
@@ -46,7 +46,7 @@ class TextRecognition:
|
|
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([
|
50 |
cv2.drawContours(mask, [polygon- np.array([[rect[0],rect[1]]])], -1, (255, 255, 255), -1, cv2.LINE_AA)
|
51 |
res = cv2.bitwise_and(cropped_image, cropped_image, mask = mask)
|
52 |
wbg = np.ones_like(cropped_image, np.uint8)*255
|
|
|
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([cropped_image.shape[0], cropped_image.shape[1]], dtype=np.uint8)
|
50 |
cv2.drawContours(mask, [polygon- np.array([[rect[0],rect[1]]])], -1, (255, 255, 255), -1, cv2.LINE_AA)
|
51 |
res = cv2.bitwise_and(cropped_image, cropped_image, mask = mask)
|
52 |
wbg = np.ones_like(cropped_image, np.uint8)*255
|