title: Python/OpenCV convert cv to cv2
body: <p>I have a python script that I wrote using OpenCV and am in the process of updating everything to OpenCV2 (cv2). The issue is when I use PIL to convert the image into a CVarray.</p>
  
  <pre><code>pil_im = pil_im.convert('L')
      cv_im = cv.CreateImageHeader(pil_im.size, cv.IPL_DEPTH_8U, 1)
      cv.SetData(cv_im, pil_im.tostring(), pil_im.size[0])
  </code></pre>
  
  <p><code>pil_im</code> is found later in my code,</p>
  
  <pre><code># Crop images
          for img in imgList:
              pil_im = Image.open(img)
              cv_im = pil2cvGrey(pil_im)
              faces = DetectFace(cv_im, faceCascade)
              if faces:
                  n = 1
                  for face in faces:
                      croppedImage = imgCrop(pil_im, face[0], padding)
                      (fname, ext) = os.path.splitext(img)
                      fname = os.path.basename(fname)
                      croppedImage.save(outputimg + '\\' + fname + ' -c' + ext)
                      n += 1
  </code></pre>
  
  <p>I know that my code works as it should I just am trying to make the pyinstaller exe smaller by only includeing CV2, currently including CV and CV2.</p>