summaryrefslogtreecommitdiff
path: root/camera_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'camera_utils.py')
-rw-r--r--camera_utils.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/camera_utils.py b/camera_utils.py
index 799efd3..03ac621 100644
--- a/camera_utils.py
+++ b/camera_utils.py
@@ -56,7 +56,8 @@ def sanity_check_image(hsv: np.ndarray) -> SanityCheckImageMetadata:
hs_zero_count += 1
logger.debug(f"hszero#={hs_zero_count}, weird_orange={weird_orange_count}")
return SanityCheckImageMetadata(
- hs_zero_count > (num_pixels * 0.75), weird_orange_count > (num_pixels * 0.75)
+ hs_zero_count > (num_pixels * 0.75),
+ weird_orange_count > (num_pixels * 0.75),
)
@@ -73,7 +74,9 @@ def fetch_camera_image_from_video_server(
response = requests.get(url, stream=False, timeout=10.0)
if response.ok:
raw = response.content
- logger.debug(f'Read {len(response.content)} byte image from HTTP server')
+ logger.debug(
+ f'Read {len(response.content)} byte image from HTTP server'
+ )
tmp = np.frombuffer(raw, dtype="uint8")
logger.debug(
f'Translated raw content into {tmp.shape} {type(tmp)} with element type {type(tmp[0])}.'
@@ -169,7 +172,9 @@ def _fetch_camera_image(
camera_name, width=width, quality=quality
)
if raw is None:
- logger.debug("Reading from video server failed; trying direct RTSP stream")
+ logger.debug(
+ "Reading from video server failed; trying direct RTSP stream"
+ )
raw = fetch_camera_image_from_rtsp_stream(camera_name, width=width)
if raw is not None and len(raw) > 0:
tmp = np.frombuffer(raw, dtype="uint8")
@@ -180,7 +185,9 @@ def _fetch_camera_image(
jpg=jpg,
hsv=hsv,
)
- msg = "Failed to retieve image from both video server and direct RTSP stream"
+ msg = (
+ "Failed to retieve image from both video server and direct RTSP stream"
+ )
logger.warning(msg)
warnings.warn(msg, stacklevel=2)
return RawJpgHsv(None, None, None)