赞
踩
将栅格数据重采样成与参考栅格图相同大小的分辨率。
from osgeo import gdal def resampling_img2(img_path, out_path, refer_img_path): """ :param img_path:待重采样影像路径 :param out_path:输出重采样影像路径 :param refer_img_path:参考影像路径 """ gdal.AllRegister() dataset_re = gdal.Open(refer_img_path) tran_RefImg = dataset_re.GetGeoTransform() dataset = gdal.Open(img_path) x_size = dataset.RasterXSize y_size = dataset.RasterYSize array = dataset.ReadAsArray(0, 0, x_size, y_size) if len(array.shape) == 3: im_height, im_width, im_bands = array.shape else: im_bands, (im_height, im_width
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。