Update utils.py
Browse files
utils.py
CHANGED
|
@@ -377,12 +377,12 @@ def get_text_to_panel_mapping(text_bboxes, sorted_panel_bboxes):
|
|
| 377 |
return text_to_panel_mapping
|
| 378 |
|
| 379 |
def sort_texts_within_panel(rects):
|
| 380 |
-
smallest_x = float("inf")
|
| 381 |
smallest_y = float("inf")
|
|
|
|
| 382 |
for i, rect in enumerate(rects):
|
| 383 |
x1, y1, x2, y2 = rect
|
| 384 |
-
smallest_x = min(smallest_x, x1)
|
| 385 |
smallest_y = min(smallest_y, y1)
|
|
|
|
| 386 |
|
| 387 |
reference_point = Point(greatest_x, smallest_y)
|
| 388 |
|
|
|
|
| 377 |
return text_to_panel_mapping
|
| 378 |
|
| 379 |
def sort_texts_within_panel(rects):
|
|
|
|
| 380 |
smallest_y = float("inf")
|
| 381 |
+
greatest_x = float("-inf")
|
| 382 |
for i, rect in enumerate(rects):
|
| 383 |
x1, y1, x2, y2 = rect
|
|
|
|
| 384 |
smallest_y = min(smallest_y, y1)
|
| 385 |
+
greatest_x = max(greatest_x, x2)
|
| 386 |
|
| 387 |
reference_point = Point(greatest_x, smallest_y)
|
| 388 |
|