import matplotlib.pylab as plt
import matplotlib.image as mpimg
im=mpimg.imread('C:/Users/xpp/Desktop/Lena.png')#读取图像
methods=['none','nearest','bilinear','bicubic','spline16','lanczos']
fig,axes=plt.subplots(nrows=2,ncols=3,figsize=(15, 30),subplot_kw={'xticks':[],'yticks':[]})
fig.subplots_adjust(hspace=0.05,wspace=0.05)
for ax, interp_method in zip(axes.flat, methods):
ax.imshow(im,interpolation=interp_method)#图像插值
ax.set_title(str(interp_method), size=20)
plt.tight_layout()
plt.show()
算法:图像插值是在基于模型框架下,从低分辨率图像生成高分辨率图像的过程,用以恢复图像中所丢失的信息。图像常见的插值算法可以分为两类:自适应和非自适应,如最近邻插值,双线性插值,双平方插值,双立方插值以及其他高阶方法等,应用于军事雷达图像、卫星遥感图像、天文观测图像、地质勘探数据图像、生物医学切片及显微图像等特殊图像及日常人物景物图像的处理。
plt.imshow(X, cmap, norm, aspect, interpolation)
文献:P Thévenaz, Blu, T. , & Unser, M. . (2009). Image interpolation and resampling - sciencedirect. Handbook of Medical Image Processing and Analysis (Second Edition), 87(3), 465-493.