matlab - Removing outliers from a grey-scale image -
question
i have images sequence representing depth information i'd clean. there outliers (values intensity below 25, 0-255 range) filled acceptable alternative (an average value localised specific area guess).
can see simple way this? i've tried use median filter (filter size of 10) substituting undesired values nan, did worsen situation, improves instead substituting them general average value.
p.s. has suggested me use fast wavelet reconstruction, not know start...
implemented solution (so far)
the solution implemented (before reading inpaint_nans
suggested tmpearce) is:
- duplicate original image;
- filling invalid pixels general average value;
- use circular disk of ray 10 blurring it;
- replacing invalid values in original image got point 3.
- run median filter of size 10.
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});
i recommend inpaint_nans contribution matlab file exchange
- start you've done replacing outliers nan
, use link go there.
from description of function:
interpolate nan elements in 2-d array using non-nan elements. can extrapolate, not use triangulation of data. inpaint_nans offers several different approaches interpolation, give tradeoffs in accuracy versus speed , memory required. methods found in inpaint_nans based on sparse linear algebra , pde discretizations. in essence, pde solved consistent information supplied.
hooray reusable code!
Comments
Post a Comment