File Exchange

image thumbnail

SNN filter

version 1.0.0.0 (983 Bytes) by Arthur Barnes
Symmetric nearest neighbor edge-preserving filter.

2 Downloads

Updated 02 Aug 2005

No License

This function implements the symmetric nearest neighbor filter, a 2D nonlinear filter that reduces noise in an image while at the same time preserving edge content. A code example follows:

RGB = imread('saturn.png');
I = rgb2gray(RGB);
J = imnoise(I,'gaussian',0,0.005);
Y = snn(J,5,true);

Cite As

Arthur Barnes (2020). SNN filter (https://www.mathworks.com/matlabcentral/fileexchange/8174-snn-filter), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

D.Regan

I got artifact on left & top of the image sides. I think that there should be problem with padding..Dear Barnes or else to help?

D.Regan

kindly update this to color images..

Vitaliano Lama

jalvarof

It also seems a good idea to unpad the result matrix Y. This can be done at the end of the file with something like:

Y = Y(PADDING+1:end,PADDING+1:end);

dragon

Error in ==> snn at 66
Y(i,j) = mean([NNnearest X(i,j)]);

solution :
replace X with Xpad ,the size of X is smaller than Xpad.
Y(i,j) = mean([NNnearest Xpad(i,j)]);

Cem

line 66 - Y(i,j) = mean([NNnearest X(i,j)]); => Y(i,j) = mean([NNnearest Xpad(i,j)]);

Anand Muglikar

nice but can u give me starting basic codes or link to them for IP using MATLAB? I will be grateful to u...

nadia ihsan

AOA.how are you, i have seen your SSN filter but cannot understand it, plz help me,if you have any other noise reduction filter then help me

jim grande

Hi,

I have the following problem with your program, trying the suggested example. I'm looking forward to hearing from you soon.

Best regards,

Jim

??? Attempted to access X(3,1201); index out of bounds because size(X)=[1500,1200].

Error in ==> snn at 66
Y(i,j) = mean([NNnearest X(i,j)]);

MATLAB Release Compatibility
Created with R14SP2
Compatible with any release
Platform Compatibility
Windows macOS Linux