Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'module' object has no attribute 'BackgroundSubtractorMOG'
- bkgnd = cv2.bgsegm.BackgroundSubtractorMOG()
- img_sub_gray_image = cv2.cvtColor(img_sub, cv2.COLOR_BGR2GRAY) cv2.error:
- bkgnd = cv2.bgsegm.BackgroundSubtractorMOG()
- cap = cv2.VideoCapture('video.mp4')
- while(True):
- ret, frame = cap.read()
- #background subtraction
- img_sub = bkgnd.apply(frame)
- #convert to grayscale
- img_sub_gray_image = cv2.cvtColor(img_sub, cv2.COLOR_BGR2GRAY)
- #thresholding, forcing to binary image
- ret,threshold1 = cv2.threshold(img_sub_gray_image, LOWER_BOUND, UPPER_BOUND, cv2.THRESH_BINARY)
- bkgnd = cv2.bgsegm.BackgroundSubtractorMOG()
- cv2.bgsegm.createBackgroundSubtractorMOG()
- fgbg = cv2.BackgroundSubtractorMOG2()
Add Comment
Please, Sign In to add comment