cctvbackend / table_occupancy.py
neerajkalyank's picture
Update table_occupancy.py
5f0ff3c verified
raw
history blame contribute delete
346 Bytes
import cv2
import numpy as np
def is_table_occupied(image):
# Convert image to grayscale and count non-zero pixels
# This is a simple heuristic to detect if a table is occupied
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
nonzero = cv2.countNonZero(gray)
return nonzero > 20000 # Threshold can be adjusted based on testing