mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-04 04:27:42 +03:00
Only check if an object is stationary to avoid mqtt snapshot
This commit is contained in:
parent
c15fbee537
commit
599699aef8
@ -249,7 +249,7 @@ class TrackedObjectProcessor(threading.Thread):
|
|||||||
|
|
||||||
def should_mqtt_snapshot(self, camera, obj: TrackedObject):
|
def should_mqtt_snapshot(self, camera, obj: TrackedObject):
|
||||||
# object never changed position
|
# object never changed position
|
||||||
if obj.obj_data["position_changes"] == 0:
|
if obj.is_stationary():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# if there are required zones and there is no overlap
|
# if there are required zones and there is no overlap
|
||||||
|
|||||||
@ -384,16 +384,16 @@ class TrackedObject:
|
|||||||
|
|
||||||
return event
|
return event
|
||||||
|
|
||||||
def is_active(self):
|
def is_active(self) -> bool:
|
||||||
return not self.is_stationary()
|
return not self.is_stationary()
|
||||||
|
|
||||||
def is_stationary(self):
|
def is_stationary(self) -> bool:
|
||||||
return (
|
return (
|
||||||
self.obj_data["motionless_count"]
|
self.obj_data["motionless_count"]
|
||||||
> self.camera_config.detect.stationary.threshold
|
> self.camera_config.detect.stationary.threshold
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_thumbnail(self, ext: str):
|
def get_thumbnail(self, ext: str) -> bytes | None:
|
||||||
img_bytes = self.get_img_bytes(
|
img_bytes = self.get_img_bytes(
|
||||||
ext, timestamp=False, bounding_box=False, crop=True, height=175
|
ext, timestamp=False, bounding_box=False, crop=True, height=175
|
||||||
)
|
)
|
||||||
@ -404,7 +404,7 @@ class TrackedObject:
|
|||||||
_, img = cv2.imencode(f".{ext}", np.zeros((175, 175, 3), np.uint8))
|
_, img = cv2.imencode(f".{ext}", np.zeros((175, 175, 3), np.uint8))
|
||||||
return img.tobytes()
|
return img.tobytes()
|
||||||
|
|
||||||
def get_clean_png(self):
|
def get_clean_png(self) -> bytes | None:
|
||||||
if self.thumbnail_data is None:
|
if self.thumbnail_data is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -433,7 +433,7 @@ class TrackedObject:
|
|||||||
crop=False,
|
crop=False,
|
||||||
height: int | None = None,
|
height: int | None = None,
|
||||||
quality: int | None = None,
|
quality: int | None = None,
|
||||||
):
|
) -> bytes | None:
|
||||||
if self.thumbnail_data is None:
|
if self.thumbnail_data is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user