def judge_direction(left_result, left_percent, right_result, right_percent):
    """
    根据左/右眼的九宫位置, 左/右眼用于判断眼球位置的有效的像素占总数的比例,给出双眼方向判定
    :param left_result: 左眼的九宫位置
    :param left_percent: 左眼用于判断眼球位置的有效的像素占总数的比例
    :param right_result: 右眼的九宫位置
    :param right_percent: 右眼用于判断眼球位置的有效的像素占总数的比例
    :return: 给出最终的双眼方向, 一个结果
    """
    if (left_result == 4) & (right_result != 4) | (right_result == 4) & (
        left_result != 4):
        return right_result if left_result == 4 else left_result
    elif (left_result == 1) & ((right_result == 0) | (right_result == 2)) | (
        right_result == 1) & ((left_result == 0) | (left_result == 2)):
        return right_result if left_result == 1 else left_result
    elif (left_result == 7) & ((right_result == 6) | (right_result == 8)) | (
        right_result == 7) & ((left_result == 6) | (left_result == 8)):
        return right_result if left_result == 7 else left_result
    elif (left_result == 3) & ((right_result == 0) | (right_result == 6)) | (
        right_result == 3) & ((left_result == 0) | (left_result == 6)):
        return right_result if left_result == 3 else left_result
    elif (left_result == 5) & ((right_result == 2) | (right_result == 8)) | (
        right_result == 5) & ((left_result == 2) | (left_result == 8)):
        return right_result if left_result == 7 else left_result
    else:
        return right_result if left_percent < right_percent else left_result
