Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

fix counters

roryclear49d46ed9f02f
diff --git a/clearcam.py b/clearcam.py
index 18be6dd..06f774a 100644
--- a/clearcam.py
+++ b/clearcam.py
@@ -457,7 +457,7 @@ class VideoCapture:
self.output_dir_raw = CAMERA_BASE_DIR / f'{cam_name}_raw' / "streams"
self.current_stream_dir = self._get_new_stream_dir()
# objects in scene count
- self.counter = RollingClassCounter(cam_name=cam_name)
+ self.counter = RollingClassCounter(cam_name=cam_name, window_seconds=float('inf'))
self.cam_name = cam_name
self.object_set = set()
self.object_set_zone = set()
@@ -685,7 +685,7 @@ class VideoCapture:
if os.path.exists(counters_file):
with open(counters_file, 'rb') as f:
counter = pickle.load(f)
- if counter is None: self.counter = RollingClassCounter(cam_name=self.cam_name)
+ if counter is None: self.counter = RollingClassCounter(cam_name=self.cam_name, window_seconds=float('inf'))
counter = self.counter
with open(counters_file, 'wb') as f:
pickle.dump(counter, f)
diff --git a/mainview.html b/mainview.html
index e1a16df..6b53433 100644
--- a/mainview.html
+++ b/mainview.html
@@ -988,7 +988,7 @@
<div id="alertsModal" class="modal">
<div class="modal-content" style="max-width: 800px; max-height: 90vh; overflow-y: auto;">
<div class="modal-header">
- <h3>Alerts - <span id="alertsCameraName"></span></h3>
+ <h3>Alerts & Counts - <span id="alertsCameraName"></span></h3>
<span class="close" onclick="closeAlertsModal()">&times;</span>
</div>
<div class="modal-body">
@@ -999,6 +999,13 @@
<button onclick="openAlertModal()">Add Alert</button>
</div>
</div>
+
+ <div class="counts-wrapper" style="display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 20px; margin: 20px 0;">
+ <table id="objectCounts" style="font-size: 1rem; border-collapse: collapse;">
+ <tbody></tbody>
+ </table>
+ <button onclick="resetCounts()">Reset</button>
+ </div>
</div>
</div>
</div>