python 遥感影像拼接

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)

你可能感兴趣的:(gdal,python,python)