我想用PlateCarree显示正射投影的真彩色图像,但是投影转换后,真彩色图像出现严重失真。我觉得图像已被降采样。
真彩色图像:
重投影图像:
代码:
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
img = plt.imread('img.png')
fig = plt.figure()
proj = ccrs.Orthographic(central_longitude=129.994492,
central_latitude=35.540474)
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())
extents = proj.transform_points(ccrs.Geodetic(), np.array([116.844, 123.30207]), np.array([36.720875,
41.65152]))
img_extents = (extents[0][0], extents[1][0], extents[0][1], extents[1][1])
ax.imshow(img, origin='upper', extent=img_extents, transform=proj)
ax.coastlines()
ax.set_extent([116.844, 123.30207, 36.720875, 41.65152])
plt.show()