Edge detection using Fuzzy Logic

조회 수: 12 (최근 30일)
Res
Res 2012년 5월 21일
답변: hamed Aghapanah 2019년 10월 4일
I am trying to detect edge of gray scale image using fuzzy logic. In my code first I am trying to detect edge and then to remove noise. Edge detection part is working,but noise removal part have not worked. Edge detection pixels have values between 0 to 50 and background pixel values have constant value i.e. 128. In case of noise removal I put if else conditions . But each checked pixel i.e. z(i,j) satisfies only if condition whether it is true or not. Following is my code.........
a=imread('a.jpg');
g1=rgb2gray(a);
g=imresize(g1,[200 200]);
[m,n]=size(g);
%figure, imshow(g)
%edge detection part
t=readfis('edge.fis');
z=uint8(zeros(m,n));
for i=2:m-1
for j=2:n-1
F = [g(i-1,j-1) g(i-1,j) g(i,j-1) g(i,j)];
h=double(F);
z(i,j)=evalfis(h,t);
end
end
disp(z)
figure, imshow(z)
%noise removal part
z2=uint8(zeros(m,n));
for i=2:m-1
for j=2:n-1
if ((0<=z(i-1,j-1)<=50) & (0<=z(i-1,j)<=50) & (0<=z(i-1,j+1)<=50) & (0<=z(i,j-1)<=50) & (0<=z(i,j)<=50) & (0<=z(i,j+1)<=50) & (0<=z(i+1,j-1)<=50) & (0<=z(i+1,j)<=50) & (0<=z(i+1,j+1)<=50))
% if z1(i-1,j-1)==0 && z1(i-1,j)==0 && z1(i-1,j+1)==0 && z1(i,j-1)==0 && z1(i,j)==0 && z1(i,j+1)==0 && z1(i+1,j-1)==0 && z1(i+1,j)==0 && z1(i+1,j+1)==0
z2(i,j)=128;
else
z2(i,j)=z(i,j);
end
end
end
figure, imshow(z2)
  댓글 수: 2
matlab_image
matlab_image 2012년 5월 31일
hi Res,
I cant help you but i need ur help. i also want to do edge detection with fuzzy logic. but i don't know how to start. can you please suggest me something for writing fuzzy logic code.
Thanks in advance
fati gh
fati gh 2014년 3월 20일
i need edge detection using fuzzy

댓글을 달려면 로그인하십시오.

답변 (3개)

Omid Sarrafzadeh
Omid Sarrafzadeh 2012년 7월 30일
Hi Res It depends on your 'edge.fis' FIS and your rules. May I know more about them?
  댓글 수: 1
Biswajit
Biswajit 2014년 3월 18일
Hi Res, Can u explain what is 'edge.fis'.

댓글을 달려면 로그인하십시오.


Arkadiy Turevskiy
Arkadiy Turevskiy 2014년 3월 20일

hamed Aghapanah
hamed Aghapanah 2019년 10월 4일
Dear Res,
I do it and ind that there are many solution to find edge. Because the result is related to Membership Functions.
which one is the best solution?
thanks

카테고리

Help CenterFile Exchange에서 Fuzzy Logic Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by