Python Opencv实践 - 图像金字塔

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")

Python Opencv实践 - 图像金字塔_第1张图片

 

你可能感兴趣的:(OpenCV实践-python,python,opencv,开发语言,计算机视觉,图像处理)