fix: Sub-Sessions original_bgr als cropped_bgr promoten
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 30s
CI / test-go-edu-search (push) Successful in 31s
CI / test-python-klausur (push) Failing after 2m22s
CI / test-python-agent-core (push) Successful in 19s
CI / test-nodejs-website (push) Successful in 18s

Spalten-/Zeilen-/Woerter-Erkennung suchen nach cropped_bgr oder
dewarped_bgr. Bei Sub-Sessions existiert nur original_bgr (der
Box-Ausschnitt). Jetzt wird original_bgr automatisch als cropped_bgr
gesetzt, sowohl im Cache-Aufbau als auch bei der Erstellung.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-09 22:57:39 +01:00
parent 9047339f0d
commit ceaef9c6a6

View File

@@ -127,6 +127,12 @@ async def _load_session_to_cache(session_id: str) -> Dict[str, Any]:
bgr = cv2.imdecode(arr, cv2.IMREAD_COLOR)
cache_entry[bgr_key] = bgr
# Sub-sessions: original image IS the cropped box region.
# Promote original_bgr to cropped_bgr so downstream steps find it.
if session.get("parent_session_id") and cache_entry["original_bgr"] is not None:
if cache_entry["cropped_bgr"] is None and cache_entry["dewarped_bgr"] is None:
cache_entry["cropped_bgr"] = cache_entry["original_bgr"]
_cache[session_id] = cache_entry
return cache_entry
@@ -465,13 +471,16 @@ async def create_box_sessions(session_id: str):
)
# Cache the BGR for immediate processing
# Promote original to cropped so column/row/word detection finds it
box_bgr = crop.copy()
_cache[sub_id] = {
"id": sub_id,
"filename": session.get("filename", "box-crop.png"),
"name": sub_name,
"original_bgr": crop.copy(),
"parent_session_id": session_id,
"original_bgr": box_bgr,
"oriented_bgr": None,
"cropped_bgr": None,
"cropped_bgr": box_bgr,
"deskewed_bgr": None,
"dewarped_bgr": None,
"orientation_result": None,