def error(data, gt, threshold, unknown_disparity=0):
    """
    Percentage of bad pixels whose error is > threshold

    """
    nb_row, nb_col = data.shape
    nb_error = 0
    for row in range(nb_row):
        for col in range(nb_col):
            if gt[row, col] != unknown_disparity:
                if abs((data[row, col] + gt[row, col])) > threshold:
                    nb_error += 1

    return nb_error / float(nb_row * nb_col)