我喜欢快速、紧凑的代码,所以我有一个问题:
def loader(input_path, new_img_width, new_img_height):
input_image = tifffile.imread(input_path)
input_image = cv2.resize(input_image, (new_img_width, new_img_height),
interpolation=cv2.INTER_NEAREST)
return input_image
在调用cv2.resize
之前,我需要添加一个条件语句来判断new_img_width
和new_img_height
是否与input_image
相同,或者这个条件语句已经包含在cv2.resize
代码中了?
除非必要,否则我不想浪费时间调整图像大小。