[gdal-dev] Linux - bash script - Sentinel 1 processing - dark images

Stefan Gofferje lists at home.gofferje.net
Sun May 22 22:04:45 PDT 2022


On 5/7/22 11:51, Stefan Gofferje wrote:
> I'm working on automatically processing Sentinel 1 data into 3 images: 
> VV, VH and VV/VH. The images come out pretty dark though. I tried to 
> mess with the exposure a little like this

[snip

> Does anybody have some hints for me how to improve the exposure/contrast 
> of the images? I have put a set of sample images and my current script 
> to my Nextcloud here: https://cloud.gofferje.net/s/3YkgH48Lmd9kcZJ

If anybody is interested, I have solved the issue by hacking together my 
first little Python script - just a short script which calculates the 
2.5 and 97.5 percentiles and outputs a scale command set.

#!/usr/bin/python3
import sys
import numpy as np
from osgeo import gdal, gdal_array
input = str(sys.argv[1])
dataset = gdal.Open(input)
array = dataset.ReadAsArray()
percentile_025 = np.percentile(array, 2.5)
percentile_975 = np.percentile(array, 97.5)
print("-scale",str(int(percentile_025)),str(int(percentile_975)),"0 255")
sys.exit()

-Stefan

-- 
  (o_   Stefan Gofferje            | SCLT, MCP, CCSA
  //\   Reg'd Linux User #247167   | VCP #2263
  V_/_  https://www.gofferje.net   | https://www.saakeskus.fi



More information about the gdal-dev mailing list