def object_within_boundary(position, obj_shape, frame_shape):
    """ checks whether the object is within the boundaries of the image
    """
    out = True
    out = out and (position[0] + obj_shape[0]//2 > 0)
    out = out and (position[0] - obj_shape[0]//2 < frame_shape[0])
    out = out and (position[1] + obj_shape[1]//2 > 0)
    out = out and (position[1] - obj_shape[1]//2 < frame_shape[1])
    return out