Compute median over multiple images

Hi,
it is possible to compute median of each pixel from multiple images of the same area?
Thank you

Assuming that your images have the same geographical footprint and the same projection, you can open all of them in SNAP and apply a band math on them. Here’s an example with 4 Sentinel-2 L2A products over the same area (40RDN):


Then you need to prefix each band with the product index in the formula, like in the Expression editor above.
Hope this helps.

Hi, thank you for your response. I have the same footprint and projection. I tried band maths, but median operator is missing in list of operators.

If the mean is okay for you, you can follow the approach Cosmin suggested. This has the benefit that the resolution is maintained.
But you could also us the mosaic tool.

If you need the median, you can use the binning tool.
Select the Percentile aggregator and set the value to 50.
Here the downside is that the reference system and the resolution are not maintained.

Hi, I need to compute median values. I will try binnig tool. Thank you.

Alternatively try r.series in QGIS/GRASS GIS: Makes each output cell value a function of the values assigned to the corresponding cells in the input raster map layers including the median. However, this interrupts the workflow and does not maintain the band naming conventions from SNAP.

Generally, I was hoping too for a function to calculate the Median being included in SNAP 10, e.g. in Raster/ Band Maths/ Functions or more specifically under Radar/ Coregistration/ Stack Tools/ Stack Averging/ Processing Parameters/ Statistic

Is there a chance for this being included in the future?

I will release a plugin for SNAP this week which allows to calculate the mean of multiple bands via the Band Maths. Not only the mean but also min and max of multiple bands. And all functions exclude NaN, infinite and invalid pixels from the calculation.


EOMasters_icon_60 Marco from EOMasters - Mastering Earth Observation

Thanks @Marco_EOM for your supportive efforts. Curious to work with and try the functionalities of the announced plugin.

1 Like

The plugin is now released. Have a look at the EOMasters Toolbox.