title: Using OpenCV detectMultiScale to find my face
body: <p>I'm pretty sure I have the general theme correct, but I'm not finding any faces. My code reads from <code>c=cv2.VideoCapture(0)</code>, i.e. the computer's videocamera. I then have the following set up to yield where the faces are. As you can see, I'm looping through different scaleFactors and minNeighbors but rects always comes back empty. I've also tried each of the four different haarcascade xml files included in the opencv/data/haarcascades package. </p>
  
  <p>Any tips?</p>
  
  <pre><code>while(1):
      ret, frame = c.read()
      rects = find_face_from_img(frame)
  
  def detect(img, cascade):
      for scale in [float(i)/10 for i in range(11, 15)]:
          for neighbors in range(2,5):
              rects = cascade.detectMultiScale(img, scaleFactor=scale, minNeighbors=neighbors,
                                               minSize=(20, 20), flags=cv2.cv.CV_HAAR_SCALE_IMAGE)
              print 'scale: %s, neighbors: %s, len rects: %d' % (scale, neighbors, len(rects))
  
  def find_face_from_img(img):
      gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
      gray = cv2.equalizeHist(gray)
      rects = detect(gray, cascade)
  </code></pre>