Exemplo n.º 1
0
    ##  you have a stop on '''
    current = datetime.datetime.now()
    new = current.second
    if ((current.second) % 4 == 0):
        if (prev != new):
            sto, direction = st.detect(frame)
            if (direction == 0):
                vce.stop_right()

            elif (direction == 1):
                vce.stop_left()

            cv2.imshow('stop', sto)
            faces, dire = fac.faceDetect(frame)
            if (dire == 0):
                vce.peopleOnRight()
            if (dire == 1):
                vce.peopleOnLeft()
            cv2.imshow('faces', faces)
            frame2 = frame
            frame2 = cv2.resize(frame2, (width, height))
            frame2 = frame2.astype('float') / 255.0
            frame2 = img_to_array(frame2)
            frame2 = np.expand_dims(frame2, axis=0)
            left, right, center = model.predict(frame2)[0]
            if (left > right and left > center):
                label = 'left'
                prob = left * 100

            if (left < right and right > center):
                label = 'right'