Spaces:
Sleeping
Sleeping
Update table_occupancy.py
Browse files- table_occupancy.py +6 -15
table_occupancy.py
CHANGED
|
@@ -1,15 +1,6 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
return False
|
| 8 |
-
|
| 9 |
-
height, _, _ = img.shape
|
| 10 |
-
# naive: check if people detected in bottom half = seated
|
| 11 |
-
bottom_half = img[height//2:, :]
|
| 12 |
-
gray = cv2.cvtColor(bottom_half, cv2.COLOR_BGR2GRAY)
|
| 13 |
-
faces = cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml")
|
| 14 |
-
detected = faces.detectMultiScale(gray, 1.1, 4)
|
| 15 |
-
return len(detected) > 0
|
|
|
|
| 1 |
+
def estimate_table_occupancy(people_count: int) -> bool:
|
| 2 |
+
"""
|
| 3 |
+
Minimal heuristic. Replace with your own table polygon checks if available.
|
| 4 |
+
Seated if there is at least 1 detected person.
|
| 5 |
+
"""
|
| 6 |
+
return people_count > 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|