fix: word_boxes in words_first use absolute pixels (consistent with v2 grid)
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 39s
CI / test-go-edu-search (push) Successful in 33s
CI / test-python-klausur (push) Failing after 2m21s
CI / test-python-agent-core (push) Successful in 22s
CI / test-nodejs-website (push) Successful in 33s
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 39s
CI / test-go-edu-search (push) Successful in 33s
CI / test-python-klausur (push) Failing after 2m21s
CI / test-python-agent-core (push) Successful in 22s
CI / test-nodejs-website (push) Successful in 33s
words_first was storing word_boxes in percent coordinates while cv_cell_grid.py uses absolute pixel coordinates. The overlay slide mechanism divides by imgW to get percentages, so percent-in-percent caused positions near zero. Now both grid builders use the same format. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -181,15 +181,15 @@ def _build_cells(
|
||||
confs = [w.get('conf', 0) for w in cell_words if w.get('conf', 0) > 0]
|
||||
avg_conf = sum(confs) / len(confs) if confs else 0.0
|
||||
|
||||
# Word boxes with percent coordinates
|
||||
# Word boxes with absolute pixel coordinates (consistent with cv_cell_grid.py)
|
||||
word_boxes = []
|
||||
for w in sorted(cell_words, key=lambda ww: (ww['top'], ww['left'])):
|
||||
word_boxes.append({
|
||||
'text': w.get('text', ''),
|
||||
'left': round(w['left'] / img_w * 100, 2) if img_w else 0,
|
||||
'top': round(w['top'] / img_h * 100, 2) if img_h else 0,
|
||||
'width': round(w['width'] / img_w * 100, 2) if img_w else 0,
|
||||
'height': round(w['height'] / img_h * 100, 2) if img_h else 0,
|
||||
'left': w['left'],
|
||||
'top': w['top'],
|
||||
'width': w['width'],
|
||||
'height': w['height'],
|
||||
'conf': w.get('conf', 0),
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user