Implement DeepMosaics restoration engine in HVideoTool: updated configuration options, integrated into the UI, and enhanced documentation in README and CLAUDE.md. The restoration process now supports both inpainting and generative models, with necessary setup instructions included.
This commit is contained in:
@@ -98,8 +98,9 @@ hvideotool/
|
||||
│ └── frame.py # Frame dataclass (image BGR, index, pts) — the detector input type
|
||||
├── restore/ # "un-censor" detected regions (per-frame)
|
||||
│ ├── base.py # Restorer ABC: restore(image, detections) -> image
|
||||
│ ├── factory.py # build_restorer(name) -> inpaint (deepmosaics/lada = not wired yet)
|
||||
│ ├── factory.py # build_restorer(name, config) -> inpaint | deepmosaics (lada = TODO)
|
||||
│ ├── inpaint.py # InpaintRestorer (cv2) — baseline, fills not reconstructs
|
||||
│ ├── deepmosaics.py # DeepMosaicsRestorer — shells out to user-installed DeepMosaics
|
||||
│ └── mask.py # detections_to_mask(shape, dets, dilate)
|
||||
└── detection/
|
||||
├── base.py # Detector ABC: detect(frame) -> list[Detection]
|
||||
@@ -142,9 +143,15 @@ hvideotool/
|
||||
caches the result in `_restored[path]`, and shows it overlay-free. "Показать оригинал/
|
||||
результат" toggles (`_showing_restored`); "Сохранить результат" writes
|
||||
`<stem>_restored.jpg` into the active collection (or beside the frame). The baseline
|
||||
is cv2 inpaint — honest: it fills, doesn't reconstruct. To add a real engine,
|
||||
implement `core/restore/base.Restorer`, register it in `restore/factory.build_restorer`,
|
||||
and swap `self._restorer`. `_show` resets `_showing_restored` + `_update_restore_actions`.
|
||||
is cv2 inpaint; the real engine is **DeepMosaics** (`restore/deepmosaics.py`), which
|
||||
shells out to a user-installed DeepMosaics repo (`deepmosaic.py --mode clean`, stdin
|
||||
closed so its error `input()` can't hang; reads the newest image from a temp
|
||||
result_dir). The engine + paths are set in `RestoreDialog` (Файл → Движок
|
||||
восстановления…), persisted, and built lazily/cached in `_make_restorer` (like
|
||||
`_make_detector`). NOTE: DeepMosaics locates mosaics itself (its `mosaic_position.pth`)
|
||||
— our detections aren't passed to it. `_show` resets `_showing_restored` +
|
||||
`_update_restore_actions`. To add another engine (e.g. LADA), implement
|
||||
`core/restore/base.Restorer` and register it in `restore/factory.build_restorer`.
|
||||
- **Navigation bar** under the image (`_build_nav_bar`): prev/next frame (◀ ▶, keys
|
||||
`,`/`.`), a scrubber `frame_slider` across the whole sequence, a `pos_label`
|
||||
("row / n"), and jump-to-detection (◀ детекция / детекция ▶, keys `[`/`]`,
|
||||
|
||||
Reference in New Issue
Block a user