0
$\begingroup$

So I'm apply the median filter to an image, but at the output, there's blue semi-dots appearing. What are they?

This is the output

enter image description here

And the python code for anyone interested

from scipy.ndimage.filters import median_filter
from matplotlib.pylab import imread, imshow, subplot, title, show, get_cmap

img = imread('images/speckle.gif')
new = median_filter(img, 3)

subplot(121); imshow(img, cmap=get_cmap('gray'));
title('The original')
subplot(122); imshow(new, cmap=get_cmap('gray'));
title('Filtered with the median_filter')

show()
$\endgroup$
  • $\begingroup$ Because that over/underflow on calculation $\endgroup$ – gmotree Jul 9 '15 at 8:47
  • $\begingroup$ I dont know what that means $\endgroup$ – Mustafa Jul 9 '15 at 19:13
  • $\begingroup$ It means that under/overflows are happen when if you are on calculate without prevent. $\endgroup$ – gmotree Jul 9 '15 at 21:46
1
$\begingroup$

Convert the image to gray scale before applying the median filter.

$\endgroup$
0
$\begingroup$

Instead of converting this image to gray and then apply median filter, an alternative is to use the vector median filter. In this context, a vector median filter considers each pixel as a 3D-vector composed by R, G, and B channel intensities, and finds a median w.r.t. to this vector instead one median for each channel.

$\endgroup$
  • $\begingroup$ I would prefer this to first converting the image to gray. But I don't know how to implement it in python. Any pointers? $\endgroup$ – Mustafa Jul 9 '15 at 19:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.