Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如果输入的宽度和高度与调整输入和宽度的大小相同,cv2.resize()会做什么?_Python_Opencv - Fatal编程技术网

Python 如果输入的宽度和高度与调整输入和宽度的大小相同,cv2.resize()会做什么?

Python 如果输入的宽度和高度与调整输入和宽度的大小相同,cv2.resize()会做什么?,python,opencv,Python,Opencv,我喜欢快速紧凑的代码,所以我有一个问题: 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_NE

我喜欢快速紧凑的代码,所以我有一个问题:

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
如果
new\u img\u width
new\u img\u height
input\u image
中的条件语句相同,或者该条件语句已经在
cv2.resize
代码中,是否需要在调用
cv2.resize
之前添加条件语句

除非有必要,否则我不想调整图像的大小。

第3961行:

if (dsize == ssize)
{
    // Source and destination are of same size. Use simple copy.
    src.copyTo(dst);
    return;
}

所以,如果我不想要不必要的副本,我最好有一个保护语句。是的,似乎resize函数总是返回一个新的Mat对象。