Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

TypeError: Incorrect type of self (must be 'CascadeClassifier' or its derivative)

Good morning,

I am running a simple python code to recognize pedestrians.When I run this code on my ubunutu machine there is no error. it works perfectly However when i run it in my Docker container I get this error. "TypeError: Incorrect type of self (must be 'CascadeClassifier' or its derivative)"

I know the container cannot generate a graphical window that's why I comment commands like imshow. But I just need it to detect and not to display anything. Because when they detect something I send an order to my robot to stop.

I don't understand why. Can anyone help please?

Here is my code :

pedestrians_cascade= cv2.CascadeClassifier('/Sunfounder_Smart_Video_Car_Kit_for_RaspberryPi/client/hogcascade_pedestrians.xml')

    incr = 0
    while True:
            s = time.time() - start_time
            while s<=9:
                    s = time.time() - start_time
                    #gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
                    bodies = pedestrians_cascade.detectMultiScale(frame)
                    tcpDecision1.stop_start(bodies, frame)
                    k = cv2.waitKey(30) & 0xff
                    if k == 27: