Reads the two images and assers identical shape.

def check_images(img_spec1, img_spec2, bkground_thresh=0.05):
    """Reads the two images and assers identical shape."""

    img1 = read_image(img_spec1, bkground_thresh)
    img2 = read_image(img_spec2, bkground_thresh)

    if img1.shape != img2.shape:
        raise ValueError('size mismatch! First image: {} Second image: {}\n'
                         'Two images to be compared must be of the same size in all dimensions.'.format(
            img1.shape,
            img2.shape))

    return img1, img2