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

具体请参见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 学习笔记(十)>>> 图像金字塔