mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-10 07:15:45 +03:00
Added support for getting status in the snapshot method.
Need to find a better solution. Current implementation is good wrt the framework
This commit is contained in:
parent
a8addf8bc6
commit
65125d0ef1
@ -199,12 +199,12 @@ class CameraState():
|
|||||||
obj_copy['frame'] = np.copy(self.current_frame)
|
obj_copy['frame'] = np.copy(self.current_frame)
|
||||||
self.best_objects[object_type] = obj_copy
|
self.best_objects[object_type] = obj_copy
|
||||||
for c in self.callbacks['snapshot']:
|
for c in self.callbacks['snapshot']:
|
||||||
c(self.name, self.best_objects[object_type])
|
c(self.name, self.best_objects[object_type],"ON")
|
||||||
else:
|
else:
|
||||||
obj_copy['frame'] = np.copy(self.current_frame)
|
obj_copy['frame'] = np.copy(self.current_frame)
|
||||||
self.best_objects[object_type] = obj_copy
|
self.best_objects[object_type] = obj_copy
|
||||||
for c in self.callbacks['snapshot']:
|
for c in self.callbacks['snapshot']:
|
||||||
c(self.name, self.best_objects[object_type])
|
c(self.name, self.best_objects[object_type],"ON")
|
||||||
|
|
||||||
# update overall camera state for each object type
|
# update overall camera state for each object type
|
||||||
obj_counter = Counter()
|
obj_counter = Counter()
|
||||||
@ -227,7 +227,7 @@ class CameraState():
|
|||||||
for c in self.callbacks['object_status']:
|
for c in self.callbacks['object_status']:
|
||||||
c(self.name, obj_name, 'OFF')
|
c(self.name, obj_name, 'OFF')
|
||||||
for c in self.callbacks['snapshot']:
|
for c in self.callbacks['snapshot']:
|
||||||
c(self.name, self.best_objects[obj_name])
|
c(self.name, self.best_objects[obj_name],"OFF")
|
||||||
|
|
||||||
|
|
||||||
class TrackedObjectProcessor(threading.Thread):
|
class TrackedObjectProcessor(threading.Thread):
|
||||||
@ -254,7 +254,7 @@ class TrackedObjectProcessor(threading.Thread):
|
|||||||
self.client.publish(f"{self.topic_prefix}/{camera}/events/end", json.dumps(obj), retain=False)
|
self.client.publish(f"{self.topic_prefix}/{camera}/events/end", json.dumps(obj), retain=False)
|
||||||
self.event_queue.put(('end', camera, obj))
|
self.event_queue.put(('end', camera, obj))
|
||||||
|
|
||||||
def snapshot(camera, obj):
|
def snapshot(camera, obj,status):
|
||||||
if not 'frame' in obj:
|
if not 'frame' in obj:
|
||||||
return
|
return
|
||||||
best_frame = cv2.cvtColor(obj['frame'], cv2.COLOR_RGB2BGR)
|
best_frame = cv2.cvtColor(obj['frame'], cv2.COLOR_RGB2BGR)
|
||||||
@ -272,7 +272,7 @@ class TrackedObjectProcessor(threading.Thread):
|
|||||||
jpg_as_text = base64.b64encode(jpg).decode()
|
jpg_as_text = base64.b64encode(jpg).decode()
|
||||||
payload={
|
payload={
|
||||||
"image": jpg_as_text,
|
"image": jpg_as_text,
|
||||||
"status":"OFF",
|
"status": status,
|
||||||
"label":obj["label"],
|
"label":obj["label"],
|
||||||
"score": obj["score"],
|
"score": obj["score"],
|
||||||
"start_time" : obj["start_time"],
|
"start_time" : obj["start_time"],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user