title: Real time human detection in Python openCV
body: <p>Now I am writing real-time human detection program in Python2.7 with openCV.
  A code I wrote was seriously slow which is referring to <a href="https://github.com/kipr/opencv/blob/master/samples/python/peopledetect.py" rel="nofollow">[sample code]</a></p>
  
  <p>The code I wrote is below.</p>
  
  <pre><code>from cv import *
  
  def inside(r, q):
      (rx, ry), (rw, rh) = r
      (qx, qy), (qw, qh) = q
      return rx &gt; qx and ry &gt; qy and rx + rw &lt; qx + qw and ry + rh &lt; qy + qh
  
  NamedWindow("people detection demo", 1)
  storage = CreateMemStorage(0) 
  capture = CaptureFromCAM(0)
  SetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, 600)
  SetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, 450)
  while True:
      img = QueryFrame(capture)
      found = list(HOGDetectMultiScale(img, storage, win_stride=(8,8),
                                       padding=(32,32), scale=1.05, group_threshold=2))
      found_filtered = []
      for r in found:
          insidef = False
          for q in found:
              if inside(r, q):
                  insidef = True
                  break
          if not insidef:
              found_filtered.append(r)
      for r in found_filtered:
          (rx, ry), (rw, rh) = r
          tl = (rx + int(rw*0.1), ry + int(rh*0.07))
          br = (rx + int(rw*0.9), ry + int(rh*0.87))
          Rectangle(img, tl, br, (0, 255, 0), 3)
  
      ShowImage("people detection demo", img)
      if WaitKey(10) == ord('q'):
          break
  </code></pre>
  
  <p>Only one image could be process nicely, but I would like to implement real-time one.
  Does anyone know how to speed up real-time human detection program?</p>