AttributeError: module 'cv2.cv2' has no attribute 'bgsegm

前端 未结 5 987
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 20:54
import numpy as np
import cv2
cap = cv2.VideoCapture(\'vtest.avi\')
fgbg = cv2.bgsegm.createBackgroundSubtractorMOG()
while(1):
    ret, frame = cap.read()
    fgmask =          


        
5条回答
  •  别那么骄傲
    2021-02-19 21:26

    If you are using python3, write:

    fgbg =cv2.createBackgroundSubtractorMOG2() #For python3
    

    And not:

    fgbg = cv2.bgsegm.createBackgroundSubtractorMOG()
    

提交回复
热议问题