mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 18:55:23 +03:00
Catch cases where incorrect size is requested
This commit is contained in:
parent
7c1568fcb9
commit
75c052ff4e
@ -1100,6 +1100,15 @@ def latest_frame(camera_name):
|
|||||||
height = int(request.args.get("h", str(frame.shape[0])))
|
height = int(request.args.get("h", str(frame.shape[0])))
|
||||||
width = int(height * frame.shape[1] / frame.shape[0])
|
width = int(height * frame.shape[1] / frame.shape[0])
|
||||||
|
|
||||||
|
if not frame:
|
||||||
|
return "Unable to get valid frame from {}".format(camera_name), 500
|
||||||
|
|
||||||
|
if height < 1 or width < 1:
|
||||||
|
return (
|
||||||
|
"Invalid height / width requested :: {} / {}".format(height, width),
|
||||||
|
400,
|
||||||
|
)
|
||||||
|
|
||||||
frame = cv2.resize(frame, dsize=(width, height), interpolation=cv2.INTER_AREA)
|
frame = cv2.resize(frame, dsize=(width, height), interpolation=cv2.INTER_AREA)
|
||||||
|
|
||||||
ret, jpg = cv2.imencode(
|
ret, jpg = cv2.imencode(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user