Skip to content

Commit

Permalink
Merge pull request #109 from marieai/AP-1684
Browse files Browse the repository at this point in the history
fix: fixed issue with negative region coordinate
  • Loading branch information
gregbugaj committed Feb 16, 2024
2 parents 4207890 + c43abe7 commit 1e68e4c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions marie/ocr/ocr_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ def __process_extract_regions(
w = region["w"]
h = region["h"]

# we can also normalize region coordinate to start at 0, 0
if x < 0 or y < 0:
self.logger.warning(
f"Region has negative coordinates : {region}"
)
output.append({"id": rid, "text": "", "confidence": 0.0})
continue
# normalize region to start from 0. ex: (0, y) | (x, 0) | (0, 0)
x = max(x, 0)
y = max(y, 0)

if w == 0 or h == 0:
self.logger.warning(
Expand Down

0 comments on commit 1e68e4c

Please sign in to comment.