Remove outliers from a gray image

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.

Basic trial

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), :

  • ;
  • ;
  • 10 ;
  • , 3.
  • 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});

Second trial

+5
3

inpaint_nans MATLAB File Exchange - , , NaN .

:

NaN 2- , NaN. , . Inpaint_nans , . , inpaint_nans, PDE. , PDE .

!

+7

roifill. . imdilate, .

:

testimage = imread('BAPz5.png');
testimage = double(rgb2gray(testimage));
testimage_filt = roifill(testimage,imdilate(testimage<100,true(4)));
figure(1);
subplot(1,2,1);
imshow(testimage,[]);
subplot(1,2,2);
imshow(testimage_filt,[]);

:

enter image description here

+4

The answer is, but only for the record, in [1] the author is based on the basic principle of natural forms, i.e. objects follow second-order smoothness; he offers a coloring method that minimizes curvature in the least square. It also offers a code . Good luck.

[1] Α Database of 3-D category objects: installation of the operation of the kinetics (ICCV)

enter image description here

+1
source

All Articles