def filter_region(image, vertices):
    """
    Create the mask using the vertices and apply it to the input image
    """
    mask = np.zeros_like(image)
    if len(mask.shape) == 2:
        cv2.fillPoly(mask, vertices, 255)
    else:
        # in case, the input image has a channel dimension
        cv2.fillPoly(mask, vertices, (255,) * mask.shape[2])

    return cv2.bitwise_and(image, mask)

    Create the mask using the vertices and apply it to the input image
    
apps/driving_pi/lane_detector.py