cv2.createBackgroundSubtractorMOG2() error
Question: 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.

    
    
    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)        
    

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

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


Answer: This is OpenCV 3.1 bug. You could disable OpenCL support as workaround.
Details is here <https://github.com/Itseez/opencv/issues/6055>

