title: Python - AttributeError: 'module' object has no attribute 'QueryFrame'
body: <p>I'm really new to OpenCV but I need to find a way to detect faces using a webcam. I have found following code from <a href="http://www.lucaamore.com/?p=638" rel="nofollow">here</a>. This is the original code. I'm using <code>Python 2.7</code> and <code>opencv 3.0.0-beta</code> version and Windows 8.1.</p>
  
  <pre><code>import cv2 as cv
  import time
  import Image
  
  def DetectFace(image, faceCascade):
  
      min_size = (20,20)
      image_scale = 2
      haar_scale = 1.1
      min_neighbors = 3
      haar_flags = 0
  
      grayscale = cv.CreateImage((image.width, image.height), 8, 1)
      smallImage = cv.CreateImage(
              (
                  cv.Round(image.width / image_scale),
                  cv.Round(image.height / image_scale)
              ), 8 ,1)
  
      cv.CvtColor(image, grayscale, cv.CV_BGR2GRAY)
      cv.Resize(grayscale, smallImage, cv.CV_INTER_LINEAR)
      cv.EqualizeHist(smallImage, smallImage)
  
      faces = cv.HaarDetectObjects(
              smallImage, faceCascade, cv.CreateMemStorage(0),
              haar_scale, min_neighbors, haar_flags, min_size)
  
      if faces:
          for ((x, y, w, h), n) in faces:
              pt1 = (int(x * image_scale), int(y * image_scale))
              pt2 = (int((x + w) * image_scale), int((y + h) * image_scale))
              cv.Rectangle(image, pt1, pt2, cv.RGB(255, 0, 0), 5, 8, 0)
  
      return image
  
  capture = cv.CaptureFromCAM(0)
  faceCascade = cv.Load("haarcascades/haarcascade_frontalface_alt.xml")
  
  while (cv.WaitKey(15)==-1):
      img = cv.QueryFrame(capture)
      image = DetectFace(img, faceCascade)
      cv.ShowImage("face detection test", image)
  
  cv.ReleaseCapture(capture)
  </code></pre>
  
  <p>When I was running this program I've got errors saying, No module named <strong>Image</strong>. I commented it and run again and did following changes to the code.</p>
  
  <p><code>capture = cv.CaptureFromCAM(0)</code> to <code>capture = cv.VideoCapture(0)</code> and 
  <code>WaitKey</code> to <code>waitKey</code> according to the errors popped up.</p>
  
  <p>But now it says <strong><code>AttributeError: 'module' object has no attribute 'QueryFrame'</code></strong>  </p>
  
  <p>I think there is a version problem or something. I've already included <code>haarcascades</code> files as well. Please help me to correct that error and run this code well. As I mention I'm a fresher to opencv.</p>