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