neerajkalyank commited on
Commit
d4922b8
·
verified ·
1 Parent(s): 800f03c

Update detect_people.py

Browse files
Files changed (1) hide show
  1. detect_people.py +5 -3
detect_people.py CHANGED
@@ -1,9 +1,11 @@
1
  import cv2
 
2
 
3
  def detect_people_from_image(image):
 
4
  gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
5
  height, width = gray.shape
6
- # Dummy logic for simulation
7
  if cv2.countNonZero(gray) > (height * width * 0.2):
8
- return 3 # pretend 3 people detected
9
- return 1
 
1
  import cv2
2
+ import numpy as np
3
 
4
  def detect_people_from_image(image):
5
+ # Convert image to grayscale
6
  gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
7
  height, width = gray.shape
8
+ # Simple heuristic: count non-zero pixels to simulate people detection
9
  if cv2.countNonZero(gray) > (height * width * 0.2):
10
+ return 3 # Simulate 3 people detected
11
+ return 1 # Simulate 1 person detected