Set new pixel radiometric values based on neighborhood?

Dear all,

I work with Orfeo (especially via Qgis processing tools. I’m performing segmentations on infrared aerial images (3 bands : NIR, R, G).
One of the problems comes from shadow (especially from trees) which affects the segmentation results. Based on an analysis of the spectral signatures of the shadow pixels, I managed to generate a mask of these pixels.I paste below a screenshot showing the aerial data + the aerial data with this cloud mask.

The idea (which might be bad) would be to generate a new aerial data by modifying the radiometric values of the three NIR, R, and V bands of the aerial data only for these shadow pixels. I thought one approach would be to define a new radiometric value for these pixels based on the values of neighboring pixels not affected by the shadow mask? In other words, the new radiometric values of the shadow pixels in aerial data would correspond to neighboring radiometric values (tree vegetation, agricultural plot, etc.). This is intended to mitigate the impact of shadow pixels on subsequent segmentation a posteriori.

Is there an OTB tool that would allow defining new radiometric values only for certain pixels of a multiband raster, based on neighboring radiometric values? (A kind of nearest neighborhood averaging, using a sliding window? or other).

Thanks so much

Hi @image80 , from what I understand from your explaination and know about OTB, an appropriate application can be BandMathX ( BandMathX — Orfeo ToolBox 10.0.0 documentation ).

You can define conditions to apply an operation depending of a input data (which is your shadow mask) and compute the mean of the neighbourhood. You have an example at BandMathX — Orfeo ToolBox 10.0.0 documentation . All operation available in BandMathX are not all listed on the cookbook but you can find more information at muparserx - Math Parser Library

Best regards

Tristan