Le processing ITS ne conserve pas le géoréférencement des images tiff lues
CONSTAT
Activer le processing ITS pour la chaîne pydiapotb créer les fichiers suivants :
- interferogram.tif
- rgb_interferogram.tif
Les commandes suivantes montrent que interferogram.tif est géoréférencée (Origin =(8049.000000000000000,17349.000000000000000)) mais pas rgb_interferogram.tif
EXEMPLE
[degoulr@visu03 output_its_processing3]$ gdalinfo interferogram.tif
Driver: GTiff/GeoTIFF
Files: interferogram.tif
Size is 500, 500
Coordinate System is ' Origin = (8049.000000000000000,17349.000000000000000) Pixel Size = (3.000000000000000,3.000000000000000) Metadata: TIFFTAG_DATETIME=2016:08:18 08:20:50 TIFFTAG_IMAGEDESCRIPTION=Sentinel-1A SM SLC L1 TIFFTAG_SOFTWARE=Sentinel-1 IPF 002.71 Image Structure Metadata: INTERLEAVE=PIXEL Corner Coordinates: Upper Left ( 8049.000, 17349.000) Lower Left ( 8049.000, 18849.000) Upper Right ( 9549.000, 17349.000) Lower Right ( 9549.000, 18849.000) Center ( 8799.000, 18099.000) Band 1 Block=500x1 Type=Float32, ColorInterp=Gray Band 2 Block=500x1 Type=Float32, ColorInterp=Undefined Band 3 Block=500x1 Type=Float32, ColorInterp=Undefined Band 4 Block=500x1 Type=Float32, ColorInterp=Undefined [degoulr@visu03 output_its_processing3]$ gdalinfo rgb_ rgb_filtered_interferogram.tif rgb_interferogram.tif rgb_ortho_interferogram.tif [degoulr@visu03 output_its_processing3]$ gdalinfo rgb_interferogram.tif Driver: GTiff/GeoTIFF Files: rgb_interferogram.tif Size is 500, 500 Coordinate System is
'
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( 0.0, 0.0)
Lower Left ( 0.0, 500.0)
Upper Right ( 500.0, 0.0)
Lower Right ( 500.0, 500.0)
Center ( 250.0, 250.0)
Band 1 Block=500x5 Type=Byte, ColorInterp=Red
Band 2 Block=500x5 Type=Byte, ColorInterp=Green
Band 3 Block=500x5 Type=Byte, ColorInterp=Blue
PROPOSITION DE RÉSOLUTION
Dans le code pydiapotb/diapotb/interf_its.py, la création de l'image de sortie a été faire avec la librairie PIL à partir de tableaux numpy. Il faudrait utiliser gdal à la place et conserver le géoréférencement de l'image d'origine.
image_hsv[:, :, 2] = new_amplitude
image_hsv[:, :, 0] = new_phase
image_hsv[:, :, 1] = new_coherence
image_rgb = hsv_to_rgb(image_hsv)
temp = np.array(255 * image_rgb, dtype=np.uint8)
outdata = Image.fromarray(temp)
outdata.save(output)
Devient
driver = gdal.GetDriverByName("GTiff")
outdata = driver.Create(outFileName, cols, rows, 1, gdal.GDT_UInt16)
outdata.SetGeoTransform(ds.GetGeoTransform()) ##sets same geotransform as input
outdata.SetProjection(ds.GetProjection()) ##sets same projection as input
outdata.GetRasterBand(1).WriteArray(arr_out) ##writing data
outdata.FlushCache()
outdata = None
band=None
ds=None