mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
remove unused current frame variable
This commit is contained in:
parent
725dd3220c
commit
5199242a68
@ -18,9 +18,8 @@ from frigate.mqtt import MqttObjectPublisher
|
|||||||
|
|
||||||
# Stores 2 seconds worth of frames so they can be used for other threads
|
# Stores 2 seconds worth of frames so they can be used for other threads
|
||||||
class FrameTracker(threading.Thread):
|
class FrameTracker(threading.Thread):
|
||||||
def __init__(self, shared_frame, frame_time, frame_ready, frame_lock, recent_frames):
|
def __init__(self, frame_time, frame_ready, frame_lock, recent_frames):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self.shared_frame = shared_frame
|
|
||||||
self.frame_time = frame_time
|
self.frame_time = frame_time
|
||||||
self.frame_ready = frame_ready
|
self.frame_ready = frame_ready
|
||||||
self.frame_lock = frame_lock
|
self.frame_lock = frame_lock
|
||||||
@ -94,14 +93,13 @@ class CameraCapture(threading.Thread):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
with self.camera.frame_lock:
|
with self.camera.frame_lock:
|
||||||
|
# TODO: use frame_queue instead
|
||||||
self.camera.frame_time.value = datetime.datetime.now().timestamp()
|
self.camera.frame_time.value = datetime.datetime.now().timestamp()
|
||||||
|
self.camera.frame_cache[self.camera.frame_time.value] = (
|
||||||
self.camera.current_frame[:] = (
|
|
||||||
np
|
np
|
||||||
.frombuffer(raw_image, np.uint8)
|
.frombuffer(raw_image, np.uint8)
|
||||||
.reshape(self.camera.frame_shape)
|
.reshape(self.camera.frame_shape)
|
||||||
)
|
)
|
||||||
self.camera.frame_cache[self.camera.frame_time.value] = self.camera.current_frame.copy()
|
|
||||||
self.camera.frame_queue.put(self.camera.frame_time.value)
|
self.camera.frame_queue.put(self.camera.frame_time.value)
|
||||||
# Notify with the condition that a new frame is ready
|
# Notify with the condition that a new frame is ready
|
||||||
with self.camera.frame_ready:
|
with self.camera.frame_ready:
|
||||||
@ -141,8 +139,6 @@ class Camera:
|
|||||||
self.mqtt_client = mqtt_client
|
self.mqtt_client = mqtt_client
|
||||||
self.mqtt_topic_prefix = '{}/{}'.format(mqtt_prefix, self.name)
|
self.mqtt_topic_prefix = '{}/{}'.format(mqtt_prefix, self.name)
|
||||||
|
|
||||||
# create a numpy array for the current frame in initialize to zeros
|
|
||||||
self.current_frame = np.zeros(self.frame_shape, np.uint8)
|
|
||||||
# create shared value for storing the frame_time
|
# create shared value for storing the frame_time
|
||||||
self.frame_time = mp.Value('d', 0.0)
|
self.frame_time = mp.Value('d', 0.0)
|
||||||
# Lock to control access to the frame
|
# Lock to control access to the frame
|
||||||
@ -184,7 +180,7 @@ class Camera:
|
|||||||
self.region_requester.start()
|
self.region_requester.start()
|
||||||
|
|
||||||
# start a thread to cache recent frames for processing
|
# start a thread to cache recent frames for processing
|
||||||
self.frame_tracker = FrameTracker(self.current_frame, self.frame_time,
|
self.frame_tracker = FrameTracker(self.frame_time,
|
||||||
self.frame_ready, self.frame_lock, self.frame_cache)
|
self.frame_ready, self.frame_lock, self.frame_cache)
|
||||||
self.frame_tracker.start()
|
self.frame_tracker.start()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user