Please help me Enhance Shadowed Pixels in Ground Images

Hi everyone,

I have high resolution ground cover RGB images with varying levels of shadow present.
I would love if someone can provide tips/code on how I can pre-process them to remove the shadow effects (enhance shadowed pixels). Shadows mainly arise from rocks, tripod, and plants. Below are some examples (screencaptures of the actual images).



After a second look - it appears that it would be very beneficial if the tiny shadows (e.g created from small leaves, branches, small rocks) were also enhanced - I assume the solution would pick these up aswell.

I’m doing a model of ground cover segmentation with three classes. The model copes well when light shadow is present so I’m not worried about that. The main concern is moderate levels of shadow. I basically want to feed the hundreds of images through some code so that the final result is an RGB image with the shadowed pixels appearing to not be in shadow anymore.

Something that increases the brightness of the shadowed pixels to match the mean brightness of the non-shadowed pixels might be a good starting idea (but I’m sure better techniques exist).

For the very dark shadows I plan on creating training data for a fourth class so I can detect these and remove these pixels from analysis (Assuming that very low brightness will be the main feature used here).

Multiple solutions are welcome :slight_smile:
Code would be greatly appreciated, especially Python. ImageJ macro would be good if that works.