MCPcopy Create free account
hub / github.com/917Dhj/DeepPaperNote / _collect_drawing_rects

Function _collect_drawing_rects

scripts/extract_pdf_assets.py:399–415  ·  view source on GitHub ↗

Gather bounding boxes of vector drawings on the page.

(page)

Source from the content-addressed store, hash-verified

397
398
399def _collect_drawing_rects(page) -> list[tuple[float, float, float, float]]:
400 """Gather bounding boxes of vector drawings on the page."""
401 rects: list[tuple[float, float, float, float]] = []
402 try:
403 for drawing in page.get_drawings():
404 r = drawing.get("rect")
405 if r is None:
406 continue
407 rect = fitz.Rect(r)
408 if rect.is_empty or rect.is_infinite:
409 continue
410 if rect.width < 10 or rect.height < 10:
411 continue
412 rects.append((rect.x0, rect.y0, rect.x1, rect.y1))
413 except Exception:
414 pass
415 return rects
416
417
418def _visual_signal_for_bbox(page, bbox: tuple[float, float, float, float]) -> tuple[int, float]:

Callers 3

_visual_signal_for_bboxFunction · 0.85
_finalize_table_bboxFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected