3

i have some troubles to get RGB true colors image from sentinel satellite bands

enter image description here

wich produce this enter image description here

to me it looks not natural at all

also i have tried gdal to do the merge with :

gdal_merge -o merged.tif -of GTIFF B04.jp2 B03.jp2 B02.jp2

but gave me an unusable file, at least in microDEM .

so i am wondering what's wrong here ?

3

You need to add the -separate option in order to place each input file into a separate band and (optionally) the -co PHOTOMETRIC=RGB creation option to force the photometric interpretation (to avoid e.g. the ColorInterp=undefined and set the right color interpretation for each band):

gdal_merge -separate -co PHOTOMETRIC=RGB -o merged.tif B04.jp2 B03.jp2 B02.jp2

Note: -of GTIFF is not necessary because GeoTIFF is the default output format.

Another approach consists into scaling the input bands before gdal_merging (but it's not strictly necessary in clients, where the bands are stretched):

for %%i in (4,3,2) do gdal_translate -scale B0%%i.jp2 B0%%i.tif
gdal_merge -separate -co PHOTOMETRIC=RGB -o merged.tif B04.tif B03.tif B02.tif

Finally the output needs some fine tuning operations, like the cut of histogram (e.g. a cumulative count cut) and the calibration of brightness, contrast and saturation, in order to be an acceptable RGB representation to use in GIS/RS clients or elsewhere. The following is a quick and dirty Sentinel-2 RGB sample created with gdal_merge and then visualized in QGIS:

enter image description here

  • unfortunally , this gave me a black image inside microdem img4.hostingpics.net/pics/922035bands2.jpg – user2475096 Mar 28 '17 at 16:50
  • here the gdalinfo of the merged file mediafire.com/file/2799z1ys1x9n0wi/out.txt – user2475096 Mar 28 '17 at 17:02
  • pleas note that Band 2 and 3 have ColorInter=undefined (don't know what this mean ...) – user2475096 Mar 28 '17 at 17:03
  • @user2475096 I've added further details above, but the answer is substantially the same. I think that the black image issue is MicroDEM specific. Try also in other GIS client, e.g. QGIS, calibrating the visualization parameters after loading the RGB image and let you know. us if it works fine. – Antonio Falciano Mar 29 '17 at 8:32
  • it worked this time :) but like you said it need a lot of tweaking to get a "natural" true color image . anyway thanks a lot, really appreciate ! – user2475096 Apr 3 '17 at 4:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.