python实现遥感影像的拼接
from osgeo import gdal, gdalconst
def RasterMosaic():
inputrasfile1 = gdal.Open("data/yx/JL1GF03B01_PMS_20210328101035_200045489_101_0003_001_L1_MSS.img", gdal.GA_ReadOnly)
inputProj1 = inputrasfile1.GetProjection()
inputrasfile2 = gdal.Open("data/yx/JL1GF03B01_PMS_20210328101035_200045489_101_0004_001_L1_MSS.img", gdal.GA_ReadOnly)
inputProj2 = inputrasfile2.GetProjection()
outputfilePath = 'RasterMosaic2.img'
options = gdal.WarpOptions(srcSRS=inputProj1, dstSRS=inputProj2, format='HFA', resampleAlg=gdalconst.GRA_Bilinear)
gdal.Warp(outputfilePath, [inputrasfile1, inputrasfile2], options=options)