Removing outliers from a grey-scale image

17 views (last 30 days)
Atcold
Atcold on 4 Apr 2013
I have an images sequence representing depth information which I'd like to clean. There are some outliers (values with intensity below 25, for a 0-255 range) which I would like to be filled with an acceptable alternative (an average value localised to that specific area could be a good guess).
Can someone see a simple way to do this? I've tried to use a median filter (filter size of 10) substituting the undesired values with NaN, but it did worsen the situation, which improves instead by substituting them with a general average value.
-
P.S. Someone has already suggested me to use a fast wavelet reconstruction, but I would not really know where to start...

Answers (1)

Image Analyst
Image Analyst on 5 Apr 2013
It looks like all your outlier data is dark. So I'd just threshold it and then use roifill() to smear the surrounding area into the black areas.
binaryImage = grayImage < 50; % or whatever.
binaryImage = imdilate(binaryImage, true(5)); % Enlarge it somewhat.
fixedImage = roifill(grayImage, binaryImage);
Try that. You might have to play around with the dilation amount and the threshold value.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!