How to coded for Order-statistic (Nonlinear) Filter

9 visualizzazioni (ultimi 30 giorni)
This code is Order-statistic (Nonlinear) Filters. Based on ordering (ranking) the pixels contained in the filter mask. Replacing the value of the center pixel with the value. Determined by the ranking result. E.g., median filter, max filter, min filter.
Matlab Code (median):
result = medfilt2(image);
..........................................................................................................................................................
clc
clear all
img=double(imread('glassware_noisy.png','png'));
[m n]=size(img);
p=3;
for i=1:m-p
for j=1:n-p
w=img(i:i+p-1,j:j+p-1);
img2(i,j) = median(w(:));
end
end
img2 = uint8(img2);
imshow(img2)
imwrite(img2,'median_filter_2015.png','png');
I wrote code blog for p=3; If we get p = 5 instead of p = 3 How does it changes the for loop and other codes? I'll be happy if you can help me.
clc
clear all
img=double(imread('glassware_noisy.png','png'));
[m n]=size(img);
p=5;
for....
...........
...........

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by