15 lines
656 B
Python
15 lines
656 B
Python
import sys, json
|
|
sys.path.insert(0,".")
|
|
from PIL import Image
|
|
from pathlib import Path
|
|
base=Path("output/AndhraJyothi_Siddipet District_20260602_20260603_144919/pages")
|
|
img=Image.open(base/"page_001.png").convert("RGB")
|
|
img.crop((2750,4750,4150,6800)).save("scratch_py/_peek_rightcol.png")
|
|
# list regions in right column area
|
|
regs=json.loads((base/"page_001.regions.json").read_text())["regions"]
|
|
print("regions with cx in [3100,4150] and y in [4750,6800]:")
|
|
for r in sorted(regs,key=lambda r:r["bbox"][1]):
|
|
b=r["bbox"]; cx=(b[0]+b[2])/2
|
|
if 3100<=cx<=4150 and b[1]<6800 and b[3]>4750:
|
|
print(f" R{r['id']:>3} {r.get('type'):<14} bbox={b}")
|