Example #1
0
cal = Calibrator()
eyes, lower, upper = cal.calibrate()

cap = cv2.VideoCapture(0)
prev_x = 0
prev_y = 0

data = []

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

    rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)

    track = Tracker()
    match = track.find_eyes(eyes, frame, lower, upper)

    total_x = 0
    total_y = 0

    avg_x = 0
    avg_y = 0

    if (len(match) > 0):
        for m in match:
            #if(m[1].distance > 40):
            total_x = total_x + m[0].pt[0]
            total_y = total_y + m[0].pt[1]

        avg_x = total_x / len(match)
        avg_y = total_y / len(match)