mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 18:55:23 +03:00
Set thumbnail height to 175
This commit is contained in:
parent
028c117cdd
commit
9e2f9a9b6f
@ -82,11 +82,11 @@ class ExternalEventProcessor:
|
||||
label: str,
|
||||
event_id: str,
|
||||
draw: dict[str, any],
|
||||
img_bytes: any,
|
||||
img_frame: any,
|
||||
) -> str:
|
||||
# write clean snapshot if enabled
|
||||
if camera_config.snapshots.clean_copy:
|
||||
ret, png = cv2.imencode(".png", img_bytes)
|
||||
ret, png = cv2.imencode(".png", img_frame)
|
||||
|
||||
if ret:
|
||||
with open(
|
||||
@ -107,7 +107,7 @@ class ExternalEventProcessor:
|
||||
height = box["box"][3] * camera_config.detect.height
|
||||
|
||||
draw_box_with_label(
|
||||
img_bytes,
|
||||
img_frame,
|
||||
x,
|
||||
y,
|
||||
x + width,
|
||||
@ -118,11 +118,17 @@ class ExternalEventProcessor:
|
||||
color=box.get("color", (255, 0, 0)),
|
||||
)
|
||||
|
||||
ret, jpg = cv2.imencode(".jpg", img_bytes)
|
||||
ret, jpg = cv2.imencode(".jpg", img_frame)
|
||||
with open(
|
||||
os.path.join(CLIPS_DIR, f"{camera_config.name}-{event_id}.jpg"),
|
||||
"wb",
|
||||
) as j:
|
||||
j.write(jpg.tobytes())
|
||||
|
||||
# create thumbnail with max height of 175 and save
|
||||
width = int(175 * img_frame.shape[1] / img_frame.shape[0])
|
||||
thumb = cv2.resize(
|
||||
img_frame, dsize=(width, 175), interpolation=cv2.INTER_AREA
|
||||
)
|
||||
ret, jpg = cv2.imencode(".jpg", thumb)
|
||||
return base64.b64encode(jpg.tobytes()).decode("utf-8")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user