File size: 403 Bytes
7c4cf26
d4922b8
7c4cf26
 
d4922b8
622591d
 
d4922b8
622591d
d4922b8
 
1
2
3
4
5
6
7
8
9
10
11
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