Zuschnitt als Regel statt als gespeichertes Bild

Die Sichtung merkt sich jetzt, WO der Vogel im Foto sitzt (vier Zahlen); die
Anzeige schneidet daraus bei jedem Aufruf. Eine geaenderte Regel wirkt damit
sofort auf den ganzen Bestand. Altbestand faellt auf das alte Bild zurueck.
This commit is contained in:
christian committed 2026-10-14 18:41:52 +00:00
1 parent f572c20080
commit a97f066e92
14 files changed
+421 -19

No files matched your search

+6
View File
@@ -36,6 +36,9 @@ class Sighting:
best_crop: Image.Image | None
best_sharpness: float
mean_bird_score: float
# Wo der Vogel im besten Bild sitzt, relativ. Die Sammlung schneidet
# daraus selbst zu -- siehe web/dex/zuschnitt.py.
best_box: tuple[float, float, float, float] | None = None
@property
def duration_s(self) -> float:
@@ -127,6 +130,7 @@ class Watcher:
self._best_sharp = -1.0
self._best_image: Image.Image | None = None
self._best_crop: Image.Image | None = None
self._best_box: tuple[float, float, float, float] | None = None
self._bird_scores: list[float] = []
self._frame_i = 0
@@ -230,6 +234,7 @@ class Watcher:
self._best_sharp = score
self._best_image = frame.copy()
self._best_crop = box.anzeige_ausschnitt(frame)
self._best_box = (box.x0, box.y0, box.x1, box.y1)
def _vote(self, box: Box, result: Result) -> None:
# Gewicht: wie sicher ist der Detektor, wie groß ist der Vogel im Bild,
@@ -279,6 +284,7 @@ class Watcher:
frames_with_bird=self._bird_frames,
best_image=self._best_image,
best_crop=self._best_crop,
best_box=self._best_box,
best_sharpness=max(0.0, self._best_sharp),
mean_bird_score=mittel,
)