def caffeBlob_to_imgGrayLinear(blob):
    """Take a caffe blob and turn it into an OpenCV image."""
    b, c = blob.shape[:2]
    if b != 1 or c != 1:
        msg = ("Expecting to get 1 image in mini-batch having 1 channel, " +
               "but got batch size of {} and {} channels".format(b, c))
        raise ValueError(msg)
    return blob[0, 0, :, :]