【发布时间】:2017-03-04 02:33:44
【问题描述】:
我正在尝试保存大小为(15000, 80000, 3) 的大图像。这个数组是一个 numpy 数组,我初始化为 im_final = np.zeros((15000,80000,,3))。为了进行保存,我使用gdal,如下所示:
dst_ds = gdal.GetDriverByName('GTiff').Create('val.tif', 80000, 15000, 3, gdal.GDT_Byte)
dst_ds.GetRasterBand(1).WriteArray(im_final[:,:,0]) # write r-band to the raster
dst_ds.GetRasterBand(2).WriteArray(im_final[:,:,1]) # write g-band to the raster
dst_ds.GetRasterBand(3).WriteArray(im_final[:,:,2]) # write b-band to the raster
dst_ds.FlushCache() # write to disk
dst_ds = None
当我保存它时,生成的图像是黑白的。但是,我需要图像是 RGB,有人知道问题是什么吗?此外,im_final 中的值为uint16。
【问题讨论】:
标签: python image numpy gis gdal