代码之家  ›  专栏  ›  技术社区  ›  empty Debilski

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

  •  0
  • empty Debilski  · 技术社区  · 8 年前

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

    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 调整大小

    除非有必要,否则我不希望花费周期来调整图像的大小。

    1 回复  |  直到 8 年前
        1
  •  2
  •   unlut    8 年前

    source code of resize function

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