import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
img = cv.imread("../SampleImages/pomeranian.png", cv.IMREAD_COLOR)
print(img.shape)
#图像上采样
#cv.pyrUp(src, dst=None, dstsize=None, borderType=None)
#参考资料:https://blog.csdn.net/Easen_Yu/article/details/89381410
img_pryUp = cv.pyrUp(img)
#图像下采样
#cv.pyrDown(src, dst=None, dstsize=None, borderType=None)
#参考资料:https://blog.csdn.net/Easen_Yu/article/details/89381410
img_pryDown = cv.pyrDown(img)
#图像显示
fig,axes = plt.subplots(nrows=1, ncols=3, figsize=(10,8), dpi=100)
axes[0].imshow(img[:,:,::-1])
axes[0].set_title("Original")
axes[1].imshow(img_pryUp[:,:,::-1])
axes[1].set_title("pryUp")
axes[2].imshow(img_pryDown[:,:,::-1])
axes[2].set_title("pryDown")
文章来源:https://www.toymoban.com/news/detail-661633.html
文章来源地址https://www.toymoban.com/news/detail-661633.html
到了这里,关于Python Opencv实践 - 图像金字塔的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!