Refactor HVideoTool to support project-based workflow: introduced project management features, updated UI for project handling, and enhanced documentation in README and CLAUDE.md. The tool now organizes images and settings into projects, improving usability and detection caching.
This commit is contained in:
@@ -9,11 +9,20 @@ DeepMosaics / LADA later) plug in behind the same interface.
|
||||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from collections.abc import Callable
|
||||
|
||||
import numpy as np
|
||||
|
||||
from ..detection.types import Detection
|
||||
|
||||
# Optional cooperative-cancel hook: returns True to abort. Engines that loop or
|
||||
# drive a subprocess should poll it; instant engines may ignore it.
|
||||
CancelCheck = Callable[[], bool]
|
||||
|
||||
|
||||
class Cancelled(Exception):
|
||||
"""Raised by a Restorer when ``should_cancel`` asked it to stop."""
|
||||
|
||||
|
||||
class Restorer(ABC):
|
||||
@property
|
||||
@@ -21,6 +30,15 @@ class Restorer(ABC):
|
||||
return type(self).__name__
|
||||
|
||||
@abstractmethod
|
||||
def restore(self, image: np.ndarray, detections: list[Detection]) -> np.ndarray:
|
||||
"""Return a copy of ``image`` with the detected regions reconstructed."""
|
||||
def restore(
|
||||
self,
|
||||
image: np.ndarray,
|
||||
detections: list[Detection],
|
||||
should_cancel: CancelCheck | None = None,
|
||||
) -> np.ndarray:
|
||||
"""Return a copy of ``image`` with the detected regions reconstructed.
|
||||
|
||||
``should_cancel`` (if given) is polled periodically; when it returns
|
||||
True the engine should abort and raise :class:`Cancelled`.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
Reference in New Issue
Block a user