feat: workable

This commit is contained in:
2026-06-12 10:25:26 +08:00
commit 3a9af920b4
32 changed files with 2079 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
import sys
import cv2
from hbc.config import GridConfig
image_path, level, r, c, out = sys.argv[1], int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]), sys.argv[5]
img = cv2.imread(image_path)
grid = GridConfig.load_json(f"layouts/level{level}.json").for_image(img.shape[1], img.shape[0])
x, y, w, h = grid.cell_box(r, c)
cv2.imwrite(out, img[y:y + h, x:x + w])
print("saved", out, "from cell", (r, c), "box", (x, y, w, h))