具体请参见OpenCV 教程

import cv2 as cv 


def image_pyramid(image):
        src = cv.imread(image)
        #h, w, c = src.shape()

        tmp = src
        dst = tmp
        c = input()
        if c == 27:
                return 0
        if c == 1:
                dst = cv.pyrUp(tmp)
        if c == 0:
                dst = cv.pyrDown(tmp)

        cv.imshow('customary', src)
        cv.imshow('pyramid', dst)


image_pyramid('/home/pi/Desktop/m2.jpg')
cv.waitKey(0)
cv.destroyAllWindows()

向上:
Python + OpenCV 学习笔记(十)>>> 图像金字塔
向下:
Python + OpenCV 学习笔记(十)>>> 图像金字塔


def continue_pyramid(image):
        src = cv.imread(image)
        tmp = src
        dst = tmp
        for i in range(4):
                dst = cv.pyrDown(dst)
                cv.imshow('result' + str(i), dst)

Python + OpenCV 学习笔记(十)>>> 图像金字塔

相关文章:

  • 2021-06-22
  • 2022-12-23
  • 2021-09-24
  • 2021-10-18
  • 2022-12-23
  • 2021-06-11
  • 2020-07-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-18
  • 2021-05-25
  • 2022-12-23
  • 2021-07-17
  • 2022-12-23
相关资源
相似解决方案