feat: add cold display alarm flow and labeled snapshots
This commit is contained in:
@@ -229,3 +229,58 @@
|
||||
- MQTT probe confirmed `video-recognition` published to `video/cold-display-guard/result/cold-display-guard` with `device_identifier=cold-display-guard`.
|
||||
- `store_data_platform` is not deployed on `10.8.0.23` under that repository name or as an identifiable container; platform handling changes were completed and verified in the local repository.
|
||||
- The cold-display retry queue has no pending entries; old `192.168.5.103` failures are already dead-letter history.
|
||||
|
||||
## Current Task: Alarm Snapshot Labels And Zone Colors
|
||||
|
||||
**Goal:** Uploaded alarm screenshots should show each calibrated region name directly on the image, and different cold-display zones should use different overlay colors.
|
||||
|
||||
**Design:** Extend the existing standard-library overlay path. Keep drawing configured polygons before JPEG upload, but carry a display label for each region, choose a stable color from a fixed palette by zone order, and draw a small high-contrast text label inside the polygon. Keep trash ROI red and labeled separately.
|
||||
|
||||
- [x] Inspect the current calibration overlay helper and tests.
|
||||
- [x] Add failing tests for per-zone colors and visible region labels.
|
||||
- [x] Implement labels and stable zone color palette.
|
||||
- [x] Run snapshot tests and full Python tests.
|
||||
- [x] Deploy the overlay update to `xiaozheng@10.8.0.23`.
|
||||
- [x] Verify remote API/runtime health and deployed overlay helper.
|
||||
|
||||
### Review
|
||||
|
||||
- `apply_calibration_overlay` now assigns each cold-display zone a stable color from a fixed palette and keeps the trash ROI red.
|
||||
- Each overlay region now carries a label and draws a small high-contrast label box directly on the frame before JPEG encoding/upload.
|
||||
- The built-in label renderer covers common现场 labels such as `区域 1` through digits and `垃圾区`, plus basic ASCII for custom numeric/English labels.
|
||||
- Verification passed:
|
||||
- `PYTHONPATH=src python3 -m unittest tests/test_alarm_snapshots.py -v`
|
||||
- `PYTHONPATH=src python3 -m unittest discover -s tests -v` (`99` tests)
|
||||
- Deployed `src/cold_display_guard/alarm_snapshots.py` to `xiaozheng@10.8.0.23` after backing up the previous remote file.
|
||||
- Rebuilt `cold-display-guard:dev` and restarted `cold-display-guard-api` plus `cold-display-guard-runtime`.
|
||||
- Remote verification passed:
|
||||
- `GET /api/manage/health` returned `status=ok` and `runtime_status=running`.
|
||||
- Container-side overlay smoke test confirmed two zones render different RGB values and label text pixels are present.
|
||||
|
||||
## Current Task: Alarm Snapshot Chinese Label Rendering Fix
|
||||
|
||||
**Goal:** Fix unreadable/garbled Chinese region names on uploaded alarm screenshots while keeping per-zone colors and fallback labeling robust.
|
||||
|
||||
**Design:** Use a real CJK font renderer for Chinese labels in the alarm snapshot overlay path. Install Noto CJK fonts in the runtime image, render labels through ffmpeg `drawtext` when the font is available, and fall back to readable ASCII labels if the font renderer is unavailable.
|
||||
|
||||
- [x] Reproduce and identify the likely root cause: remote container only matched DejaVu for `zh-cn`, so Chinese labels had no real CJK font path.
|
||||
- [x] Add regression tests for Docker CJK font installation and readable ASCII fallback labels.
|
||||
- [x] Update `Dockerfile` to install `fonts-noto-cjk`.
|
||||
- [x] Update `alarm_snapshots.py` to prefer CJK font rendering and use `R1`/`TRASH` fallback text when needed.
|
||||
- [x] Run focused and full local Python verification.
|
||||
- [x] Deploy `Dockerfile` and `alarm_snapshots.py` to `xiaozheng@10.8.0.23` without overwriting live config.
|
||||
- [x] Rebuild/restart `cold-display-guard-api` and `cold-display-guard-runtime`.
|
||||
- [x] Verify remote API/runtime health, CJK font availability, overlay smoke behavior, and runtime logs.
|
||||
|
||||
### Review
|
||||
|
||||
- Root cause was the screenshot overlay path not having a real Chinese font renderer in the deployed image; the container matched DejaVu before this fix.
|
||||
- The rebuilt remote container now reports `NotoSansCJK-Regular.ttc: "Noto Sans CJK SC" "Regular"` for `fc-match :lang=zh-cn`.
|
||||
- Remote overlay smoke test confirmed `find_cjk_font_file()` returns `/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc`, Chinese labels change the frame, bright label pixels are present, and different regions retain distinct colors.
|
||||
- Local verification passed:
|
||||
- `PYTHONPATH=src python3 -m unittest tests/test_alarm_snapshots.py -v`
|
||||
- `PYTHONPATH=src python3 -m unittest discover -s tests -v` (`101` tests)
|
||||
- Remote verification passed:
|
||||
- `GET /api/manage/health` returned `status=ok`, `runtime_status=running`, and version `dev`.
|
||||
- `cold-display-guard-api` is healthy and `cold-display-guard-runtime` is running after restart.
|
||||
- Runtime logs show normal startup after the restart.
|
||||
|
||||
Reference in New Issue
Block a user