return_boxes_of_images_by_order_of_reading_new: improve

- when searching for multi-col box makers, pick the right-most
  allowable column, not the left-most
This commit is contained in:
Robert Sachunsky 2025-11-28 18:04:12 +01:00
parent 5abf0c1097
commit 84d10962f3

View file

@ -1796,7 +1796,7 @@ def return_boxes_of_images_by_order_of_reading_new(
# "box height", (y_bot - y_top), # "box height", (y_bot - y_top),
# "label height", sum(regions_without_separators[ # "label height", sum(regions_without_separators[
# y_top: y_bot, peaks_neg_tot[start + 1]])) # y_top: y_bot, peaks_neg_tot[start + 1]]))
return min((last for last, l_top, l_bot, l_count in labelcolmap.get(start, []) return max((last for last, l_top, l_bot, l_count in labelcolmap.get(start, [])
# yield the right-most column that does not cut through # yield the right-most column that does not cut through
# any regions in this horizontal span # any regions in this horizontal span
if y_top < l_bot and y_bot > l_top if y_top < l_bot and y_bot > l_top