def mat2gray(img):
    max_img = np.max(img)
    min_img = np.min(img)
    imgout = ((img - min_img) / (max_img - min_img))
    return imgout
def mat2gray(img):
    max_img = np.max(img)
    min_img = np.min(img)
    imgout = ((img - min_img) / (max_img - min_img))
    return imgout