workers / wine_inventory / src / pince_shelf / roi / ROI_ADjustment_from_PNG.py¶
Path: workers/wine_inventory/src/pince_shelf/roi/ROI_ADjustment_from_PNG.py
Lane: workers
Executable: yes
Purpose¶
Interactive editor to adjust existing cell polygons on a shelf snapshot.
The tool loads:
- image:
<snapshot_dir>/shelf_rectified.jpg - ROI JSON:
<snapshot_dir>/cells_polygons.json
It displays polygons on the image and lets you move one selected ROI at a time.
On save (s), polygons are written back to JSON coordinates and centroids are
recomputed.
Runtime and config behavior:
- prints runtime diagnostics from
runtime_info()(system,hostname, Raspberry Pi detection, GUI availability,cwd,CONF_DIR) - resolves INI as
CONF_DIR/pince_shelf.ini - selects config loader by OS:
Darwin->load_pince_config_darwin()- otherwise ->
load_pince_config()
CLI options:
--step: normal movement step in pixels (default:2)--step-fast: fast movement step in pixels (default:10)
Controls:
- Arrow keys: move selected ROI
TAB: select next ROIb: select previous ROIf: toggle fast movements: save to<snapshot_dir>/cells_polygons.jsonqorESC: quit
Scope:
- adjusts existing ROIs only; does not create new cells
- for initial ROI generation, use
generate_mask_for_polc.py
Entry points¶
__main__guard detected
Key symbols¶
Classes¶
- (none detected)
Functions¶
clamp_polygon(poly_xy, w, h)draw_rois(img_bgr, rois, selected_idx)key_is_arrow(key)load_rois(json_path)main()polygon_centroid(poly_xy)runtime_info()save_rois(meta, out_json)scale_polygon(poly_xy, sx, sy)translate_polygon(poly_xy, dx, dy)unscale_polygon(poly_xy, sx, sy)
Configuration & environment¶
- (no env vars detected by regex)
Dependencies (imports)¶
argparsecv2jsonnumpyospathlibpince_shelf.utils.pathsplatformsocket
Operational notes (fill in)¶
- Headless/interactive:
- Systemd unit (if any):
- Schedules/triggers:
- Debug artifacts:
- Failure modes: