import numpy as np
import cv2
cap = cv2.VideoCapture('vtest.avi')
fgbg = cv2.bgsegm.createBackgroundSubtractorMOG()
while(1):
ret, frame = cap.read()
fgmask = fgbg.apply(frame)
cv2.imshow('frame',fgmask)
k = cv2.waitKey(30) & 0xff
if k == 27:
break
cap.release()
cv2.destroyAllWindows()
I am getting the following error: AttributeError: module 'cv2.cv2' has no attribute 'bgsegm'.
I am using Python 3.6 with OpenCV 3.6 on windows machine. I tried using the pip install opencv-contrib-python command but still the problem remains same on my windows machine. This command helped be on Ubuntu system, but not on windows. I searched similar problems on stack but couldn't solve this issue. Can someone help me out on this? Thanks!
pip install opencv-contrib-python
? If no, then can you please elaborate more on this? – Brita