Question
I have a sequence of images representing depth information that I would like to clear. There are some outliers (values with intensities below 25, for the range 0-255) that I would like to fill out with an acceptable alternative (the average value localized in this particular area may be a good guess).
Can anyone see an easy way to do this? I tried to use a median filter (filter size 10), replacing unwanted values with NaN, but this made the situation worse, which improved, replacing them with a common average value.

PS Someone has already suggested that I use fast wavelet reconstruction, but I would not know where to start ...
Implemented solution (for now)
( , inpaint_nans, tmpearce), :
img2 = img;
img2(img < .005) = mean(img(:));
H = fspecial('disk',10);
img3 = imfilter(img2,H,'symmetric');
img4 = img;
img4(img < .3) = img3(img < .3);
filterSize = 10;
padopt = {'zeros','indexed','symmetric'};
IMG = medfilt2(img4, [1 1]*filterSize, padopt{p});
