Esempio n. 1
0
    frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
    coppia_punti = []
    boxes, scores = open_cv_wrapper.detect_objects(frame, detector, sess)
    # draw bounding boxes on frame
    center = open_cv_wrapper.draw_box_on_image(num_hands_detect, threshold,
                                               scores, boxes, im_width,
                                               im_height, frame)
    if center:
        if len(center) == 1:
            s = 0
            c = 0
            seq.append(center[0])
            if len(seq) == 5:
                movimento = open_cv_wrapper.check_movement(seq, frame)
                print(movimento)
                browser.movement_detection(movimento)
                seq.pop(0)
        else:
            s += 1
            if s >= 5:
                is_browser_active = browser.is_active()
                if is_browser_active is not None and is_browser_active:
                    browser.close()
                    s = 0
                    continue
    else:
        c += 1
        if c == 3:
            seq = []
            s = 0