Skip to content

Commit

Permalink
Merge pull request #224 from Alexqwesa/patch-1
Browse files Browse the repository at this point in the history
fix for OpenCV => 4.5.2
  • Loading branch information
faustomorales committed Dec 24, 2022
2 parents 40bb9bd + 33991c8 commit 1d241e8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions keras_ocr/data_generation.py
Expand Up @@ -438,7 +438,7 @@ def draw_text_image(
while not all(
cv2.pointPolygonTest(contour=transformed_contour, pt=pt, measureDist=False)
>= 0
for pt in [(x, y), (x2, y), (x2, y2), (x, y2)]
for pt in [(int(x), int(y)), (int(x2), int(y)), (int(x2), int(y2)), (int(x), int(y2))]
):
if x2 > end_x:
dy = max(1, max_y - y)
Expand Down Expand Up @@ -533,7 +533,7 @@ def compute_transformed_contour(width, height, fontsize, M, contour, minarea=0.5
inside = (
np.array(
[
cv2.pointPolygonTest(contour=contour, pt=(x, y), measureDist=False) >= 0
cv2.pointPolygonTest(contour=contour, pt=(int(x), int(y)), measureDist=False) >= 0
for x, y in slots
]
)
Expand Down Expand Up @@ -568,7 +568,7 @@ def compute_transformed_contour(width, height, fontsize, M, contour, minarea=0.5
next(
index
for index, contour in enumerate(newContours)
if cv2.pointPolygonTest(contour=contour, pt=(x, y), measureDist=False) >= 0
if cv2.pointPolygonTest(contour=contour, pt=(int(x), int(y)), measureDist=False) >= 0
)
][:, 0, :]
return contour
Expand Down

0 comments on commit 1d241e8

Please sign in to comment.