Created
May 13, 2019 17:46
-
-
Save berkayakcay/bcc2385465fe240fcf2c7d23252de39d to your computer and use it in GitHub Desktop.
Image Processing MATLAB Median Algoritması
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clc; clear; close all; | |
I= imread('p.jpg'); | |
I = rgb2gray(I); | |
[R,C] = size(I); | |
SI = uint8(zeros(R,C)); | |
for r=1:R | |
for c=1:C | |
ListOfValues = 1:9; | |
counter = 0; | |
for i=-1:1 | |
for j=-1:1 | |
counter = counter + 1; | |
if(((r+i)>0) && ((c+j)>0) && ((r+i)<=R) && ((c+j)<=C)) | |
ListOfValues(counter) = I(r+i,c+j); | |
end | |
end | |
end | |
SI(r,c) = median(ListOfValues); | |
ListOfValues = []; | |
end | |
end | |
imshow(I); | |
figure; | |
imshow(SI); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment