Note that there are some explanatory texts on larger screens.

plurals
  1. PORemoving outliers from a grey-scale image
    primarykey
    data
    text
    <h1>Question</h1> <p>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).</p> <p>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> <p><img src="https://i.stack.imgur.com/xwJ6B.png" alt="Basic trial"></p> <p>P.S. Someone has already suggested me to use a <em>fast wavelet reconstruction</em>, but I would not really know where to start...</p> <h1>Implemented solution (so far)</h1> <p>The solution I implemented (before reading about <code>inpaint_nans</code> suggested by <a href="https://stackoverflow.com/users/1214731/tmpearce"><strong>tmpearce</strong></a>) is:</p> <ol> <li>duplicate the original image;</li> <li>filling the invalid pixels with a general average value;</li> <li>use a circular disk of ray 10 for blurring it;</li> <li>replacing the invalid values in the original image with what I got from point 3.</li> <li>run a median filter of size 10.</li> </ol> <pre class="lang-default prettyprint-override"><code>img2 = img; img2(img &lt; .005) = mean(img(:)); H = fspecial('disk',10); img3 = imfilter(img2,H,'symmetric'); img4 = img; img4(img &lt; .3) = img3(img &lt; .3); filterSize = 10; padopt = {'zeros','indexed','symmetric'}; IMG = medfilt2(img4, [1 1]*filterSize, padopt{p}); </code></pre> <p><img src="https://i.stack.imgur.com/Zb1tm.png" alt="Second trial"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload