Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

AttributeError: 'builtin_function_or_method' object has no attribute 'apply'

cv2 Problem.. I was watching not that old of a tutorial about object tracking and stumbled in this error

AttributeError: 'builtin_function_or_method' object has no attribute 'apply'

This is the code around the issue.

object_detector = cv2.createBackgroundSubtractorMOG2

while True:
    ret, frame = cap.read()

    mask = object_detector.apply(frame)

    cv2.imshow("Frame", frame)
    cv2.imshow("Mask", mask)

In The tutorial the guy did the exact same thing!!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

you did not create the object_detector properly, it has to be:

object_detector = cv2.createBackgroundSubtractorMOG2() # BRACES !!!

you only made a copy of the create() function, not invoke it)

(also, rather use opencv’s tutorials for this !!)

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading