mahaveerverma / hand-gesture-recognition-opencv

A project on hand detection and hand gesture recognition developed using OpenCV on Python 2.7.
MIT License
319 stars 132 forks source link

Capture background issue #15

Open bedfl2016 opened 5 years ago

bedfl2016 commented 5 years ago

When I press b to capture background I get this error Traceback (most recent call last): File "C:\Users\laure\OneDrive\Desktop\hand-gesture-recognition-opencv-master\HandRecognition.py", line 191, in fg_frame=remove_bg(frame) File "C:\Users\laure\OneDrive\Desktop\hand-gesture-recognition-opencv-master\HandRecognition.py", line 167, in remove_bg fg_mask=bg_model.apply(frame) TypeError: Incorrect type of self (must be 'BackgroundSubtractorMOG2' or its derivative) [Finished in 8.6s]

anantSinghCross commented 5 years ago

I'm having the same problem

ladybirdhui commented 5 years ago

you can change the code cv2.BackgroundSubtractorMOG2(0,10) to cv2.createBackgroundSubtractorMOG2(0,10)

PR-Iyyer commented 5 years ago

its already cv2.createBackgroundSubtractorMOG2(0,10) and still the error coming

FUZIRONG commented 5 years ago

change the code cv2.BackgroundSubtractorMOG2(0,10) to cv2.createBackgroundSubtractorMOG2(0,10),it's right.and,you need change contours,hierarchy=cv2.findContours(contour_frame,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) to frame,contours,hierarchy=cv2.findContours(contour_frame,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE),if you use opencv 3.