So im using the example provided for nlfilter in MATLAB:
A = imread('cameraman.tif');A = im2double(A);fun = @(x) median(x(:));B = nlfilter(A,[3 3],fun);imshow(A), figure, imshow(B)
I am wondering how can I define a function that has more than one input, meaning that if I want instead of just median have also the mean, is there anyway that the B matrix become N1*N2*2 instead of being N1*N2
Or for example a more complete version of my question is that how I can have this:
fun = @(x) (sort(x(:))) ; B= nlfilter(A,[3 3],fun);
when B is N1*N2*9, and N1 and N2 are the size of the image
Best Answer