Spaces:
Sleeping
Sleeping
import cv2 | |
import numpy as np | |
def detect_people_from_image(image): | |
# Convert image to grayscale | |
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | |
height, width = gray.shape | |
# Simple heuristic: count non-zero pixels to simulate people detection | |
if cv2.countNonZero(gray) > (height * width * 0.2): | |
return 3 # Simulate 3 people detected | |
return 1 # Simulate 1 person detected |