There is a code like this that highlights cars, how do I make people stand out? I tried to play with the settings, it turns out badly. ps I'm just learning and figuring it out.
while True:
ret, frame = cap.read() # import image
if ret: # if there is a frame continue with code
image = cv2.resize( frame, (0 , 0 ), None, ratio, ratio) # resize image
gray = cv2.cvtColor( image, cv2.COLOR_BGR2GRAY) # converts image to gray
fgmask = fgbg.apply(gray) # uses the background subtraction
# applies different thresholds to fgmask to try and isolate cars
# just have to keep playing around with settings until cars are easily identifiable
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5)) # kernel to apply to the morphology
closing = cv2.morphologyEx( fgmask, cv2.MORPH_CLOSE, kernel)
opening = cv2.morphologyEx( closing, cv2.MORPH_OPEN, kernel)
dilation = cv2.dilate(opening, kernel)
retvalbin, bins = cv2.threshold(dilation, 220, 255, cv2.THRESH_BINARY) # removes the shadows
# creates contours
im2, contours, hierarchy = cv2.findContours( bins, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
# use convex hull to create polygon around contours
hull = [cv2.convexHull(c) for c in contours]
# draw contours
cv2.drawContours( image, hull, - 1 , ( 0 , 255 , 0 ), 3)