title: Full body haar cascade detections using OpenCV Python
body: <p>I am trying to detect persons using <code>opencv</code> <code>python</code> with <code>haarcascade</code>. I am using <code>haarcascade_fullbody.xml</code> and below is the code:</p>
  <pre><code>import cv2
  
  body_classifier = cv2.CascadeClassifier('haarcascade_fullbody.xml')
  
  frame = cv2.imread('2.jpg')
  gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
  
  bodies = body_classifier.detectMultiScale(gray, 1.2, 3)
  
  for (x, y, w, h) in bodies:
      cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 255), 2)
  
  cv2.imshow('Humans', frame)
  cv2.waitKey()
  cv2.destroyAllWindows()
  </code></pre>
  <p>Input image (taken from google):</p>
  <p><a href="https://i.stack.imgur.com/9Ff6f.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9Ff6f.jpg" alt="enter image description here" /></a></p>
  <p>Its not able to detect persons in the image file. I am not sure if I have done something wrong or not. I have to run this on <code>raspberry pi</code> due to which I am using <code>haarcascading</code> otherwise I would have used <code>mobilenet ssd</code> models which works more accurately than haarcascade. Can anyone please tell me how can I use haarcascade to detect persons. Is there any other way of detecting persons on raspberry.?</p>