本文整理汇总了Python中scipy.io.imsave方法的典型用法代码示例。如果您正苦于以下问题:Python io.imsave方法的具体用法?Python io.imsave怎么用?Python io.imsave使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scipy.io
的用法示例。
在下文中一共展示了io.imsave方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save_image
# 需要导入模块: from scipy import io [as 别名]
# 或者: from scipy.io import imsave [as 别名]
def save_image(image, save_dir, name):
"""
Save image by unprocessing and converting to rgb.
:param image: iamge to save
:param save_dir: location to save image at
:param name: prefix to save filename
:return:
"""
image = color.lab2rgb(image)
io.imsave(os.path.join(save_dir, name + ".png"), image)
示例2: main
# 需要导入模块: from scipy import io [as 别名]
# 或者: from scipy.io import imsave [as 别名]
def main():
args = get_args()
output_path = args.output
img_size = args.img_size
mypath = '../data/CACD2000'
isPlot = False
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
# landmark_list = []
# for i in tqdm(range(len(onlyfiles))):
# landmark_list.append(get_landmarks(onlyfiles[i], args))
landmark_ref = np.matrix(np.load('../data/CACD_mean_face.npy', allow_pickle=True))
# Points used to line up the images.
ALIGN_POINTS = list(range(16))
for i in tqdm(range(len(onlyfiles))):
img_name = onlyfiles[i]
input_img = cv2.imread(mypath+'/'+img_name)
input_img = cv2.cvtColor(input_img, cv2.COLOR_BGR2RGB)
img_h, img_w, _ = np.shape(input_img)
landmark = get_landmarks(img_name, args)[0]
M = transformation_from_points(landmark_ref[ALIGN_POINTS],
landmark[ALIGN_POINTS])
input_img = warp_im(input_img, M, (256, 256, 3))
io.imsave(args.output +'/'+ img_name, input_img)