title: cv2.createBackgroundSubtractorMOG2() error
body: <p>Could anyone help me on this one?
  I'm trying for a background Subtracting method and used to perfectly run fine while using the cv2.BackgroundSubtractorMOG() method in previous opencv versions.</p>
  
  <pre><code>import cv2
  backsub = cv2.createBackgroundSubtractorMOG2()
  capture = cv2.VideoCapture("headcount.avi")
  i = 0
  if capture:
    while True:
  
      ret, frame = capture.read()
      if ret:
          fgmask = backsub.apply(frame, None, 0.01)
          erode=cv2.erode(fgmask,Nonei,terations=3)
          moments=cv2.moments(erode,True)        
  </code></pre>
  
  <p>But using opencv 3.1.0 i'm facing problems while using the cv2.createBackgroundSubtractorMOG2() function and this is the error i'm getting,while applying mask operation</p>
  
  <p>Error:
   fgmask = backsub.apply(frame, 1, 0.01)
  error: C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\python\src2\cv2.cpp:163: error: (-215) The data should normally be NULL! in function NumpyAllocator::allocate </p>