import math


def _remove_edge_blobs(blobs, image_shape):
    """Remove blobs detected around the edge of the image.

    :param blobs: list of blobs detected from the image
    :param image_shape: shape of the image. Provides the bounds to check.
    :returns: list of filtered blobs
    """
    img_height, img_width = image_shape

    def check_within_image(blob):
        y, x, r = blob
        r = math.ceil(r)
        return not ((x - r < 0 or x + r >= img_width) or
                    (y - r < 0 or y + r >= img_height))

    return filter(check_within_image, blobs)