Average with limited data validity

In image analysis, the average with limited data validity is an image filter for feature-preserving noise removal, consisting in a smoothing filter that only involves pixels satisfying some validity criterion. If some feature of noise elements is known, it is possible to use it to define a criterion to detect invalid pixels, and selectively smooth only invalid pixels using data coming only from valid pixels, thus avoiding to affect other features of the image.

Possible criteria are:
 * based on image intensity, by defining an interval $$[I_{min}, I_{max}]$$ of invalid data, with the filter only modifying pixels in that interval and only averaging data from other pixels from its neighbourhood that are valid, i.e. their intensity does not fall in the same interval. For instance, given a pixel $$(x,y)$$ of invalid data, its convolution kernel $$h$$ becomes
 * $$h_{ij} =

\begin{cases} 1 \quad I_{x+i,y+j} \notin [I_{min}, I_{max}] \\ 0 \quad \text{otherwise} \end{cases}$$
 * This approach allows to effectively remove extraneous elements that have different intensity from the rest of the image, with blurring limited to valid parts of the image which share intensity values with the extraneous elements, or portions of edges that were previously covered by such extraneous artefacts.


 * based on image brightness, similarly defining an interval of invalid brightness change, with the filter only involving pixels that fall in that interval. This approach allows to remove artefacts due to a continuous change of background brightness.
 * based on edge strength, by computing some gradient operator over the image and using its value to define as invalid those pixels that fall beyond a certain threshold. This approach gives an edge-preserving smoothing.