title: OpenCV 3 Python - Haar Cascade Upper Body Detector doesn't work on a half body (waist up) photo?
body: <p>I've been trying to detect people in photos and I've had some success with pedestrians. However, for my use case scenario, I need to be able to detect half body/upper body (waist up) or heads in photo. </p>
  
  <p>I tried the haar cascade for the upper body. Here is the code I used:</p>
  
  <pre><code>import numpy as np
  import cv2
  
  img = cv2.imread('/path/to/img.jpg',0)
  
  upperBody_cascade = cv2.CascadeClassifier('path/to/haarcascade_upperbody.xml')    
  
  arrUpperBody = upperBody_cascade.detectMultiScale(img)
  if arrUpperBody != ():
          for (x,y,w,h) in arrUpperBody:
              cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
          print 'body found'
  
  cv2.imshow('image',img)
  cv2.waitKey(0)
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>And I had 3 test images I used. Kindly note that it's the same image, cropped at certain levels.</p>
  
  <ol>
  <li>Knee Up</li>
  <li>Waist Up</li>
  <li>Chest Up</li>
  </ol>
  
  <p>Here were the results I got:</p>
  
  <ol>
  <li>Knee Up</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/wJhGD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wJhGD.png" alt="Knee Up"></a></p>
  
  <ol start="2">
  <li>Waist Up</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/cZegi.png" rel="noreferrer"><img src="https://i.stack.imgur.com/cZegi.png" alt="Waist Up"></a></p>
  
  <ol start="3">
  <li>Chest Up</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/4MPd7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4MPd7.png" alt="Chest Up"></a></p>
  
  <p>As you can see, the Knee Up and Chest Up photos were able to detect the upper body and head area respectively. </p>
  
  <p>However, the waist up photo didn't return any results, even if the upper body and the head are visible.</p>
  
  <p>Does anyone know how or why this happens and what can be done to make the upper body detection much more consistent?</p>