title: Attribute error while using opencv for face recognition
body: <p>I am teaching myself how to use openCV by writing a simple face recognition program I found on youtube. I have installed <code>opencv version 2</code> as well as <code>numpy 1.8.0</code>. I am using <code>python 2.7</code>.</p>
  <p>I copyed this code exactly how it was done in the video and article links below, yet I keep getting errors.</p>
  <blockquote>
  <p>AttributeError: 'module' object has no attribute 'cv'</p>
  </blockquote>
  <p>What am I doing wrong?
  Here is the code I'm using.</p>
  <pre><code>import cv2
  import sys
  
  # Get user supplied values
  imagePath = sys.argv[1]
  cascPath = sys.argv[2]
  
  # Create the haar cascade
  faceCascade = cv2.CascadeClassifier(cascPath)
  
  # Read the image
  image = cv2.imread(imagePath)
  gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
  
  # Detect faces in the image
  faces = (faceCascade.detectMultiScale(
      gray,
      scaleFactor=1.1,
      minNeighbors=5,
      minSize=(30, 30),
      flags = cv2.cv.CV_HAAR_SCALE_IMAGE)
  )
  
  print &quot;Found {0} faces!&quot;.format(len(faces))
  
  # Draw a rectangle around the faces
  for (x, y, w, h) in faces:
      cv2.rectangle(image, (x, y), (x+w, y+h), (0, 255, 0), 2)
  
  cv2.imshow(&quot;Faces found&quot;, image)
  cv2.waitKey(0)
  </code></pre>
  <p><a href="https://www.youtube.com/watch?v=IiMIKKOfjqE" rel="nofollow noreferrer">https://www.youtube.com/watch?v=IiMIKKOfjqE</a></p>
  <p><a href="https://realpython.com/blog/python/face-recognition-with-python/" rel="nofollow noreferrer">https://realpython.com/blog/python/face-recognition-with-python/</a></p>