File size: 346 Bytes
c648e28
5f0ff3c
c648e28
5250869
5f0ff3c
 
5250869
c648e28
5f0ff3c
1
2
3
4
5
6
7
8
9
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