Is there a way to apply a blur or median smoothing filter to an image, while supplying a mask of pixels that should be ignored?
I have a height map from a laser-scanner which I want to smooth. The map is not continuous; wherever there is empty space the image simply contains no height data.
If I arbitrarily set the height for missing values to zero (or any other value) and then blur the image, this will introduce a lot of error around the edges of objects.
So I need to supply a binary mask to the blur. Masked pixels should not only remain unchanged, but should also be ignored when calculating the new blur or median value of neighbor pixels.
How can I accomplish this?