我喜欢快速、紧凑的代码,所以我有一个问题:
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
Run Code Online (Sandbox Code Playgroud)
我是否需要在调用之前添加条件语句cv2.resize,以处理其中new_img_width和new_img_height相同的情况input_image或cv2.resize代码中已经存在的条件语句?
除非有必要,否则我不想花费周期调整图像大小。
来自resize function的源代码,第 3961 行:
if (dsize == ssize)
{
// Source and destination are of same size. Use simple copy.
src.copyTo(dst);
return;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
602 次 |
| 最近记录: |