fuzzy image processing problem
Message-ID:<61023b46-823f-4777-9e98-f27d933e073c@9g2000yqa.googlegroups.com>
Subject:
fuzzy image processing problem
Date:Mon, 30 Nov 2009 12:09:51 +0100
Dear all,
iam trying to implement the paper
Fuzzy Edge Detection Based on Pixel's Gradient and Standard Deviation
Values
http://www.proceedings2009.imcsit.org/pliks/53.pdf
and here is my code but i think it does not work well , i need help .
function out=FIP2(im) %fuzzy image processing
warning off all;
image=imread(im);
im=double(image);
[Xim,Yim]=size(im); % getting size of the image
G=im; %generate Gradient matrix
% we will depend on two parameters gradient and standard deviation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% first : Calculate the Gradient of image using SObel operator
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%using the sobel filter
h=fspecial('gaussian',[3 3] ,0.1);
G=imfilter(G,h);
if min(G(:))<1
G=G-min(G(:)); % to make scale for negative pixels
end
Gmaxval=max(G(:));%getting the max vlue from the Gradient image to
make scaling for pixel values(0->100)
pixval on ;
%figure('name','Gradient');imshow(G);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Second :Calculate the SD(Standard Deviation of image)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SD = nlfilter(im,[3 3],'std2');
SDmaxval=max(SD(:)); %getting the max value from the SD image to make
scaling for pixel values (0->100 )
%pixval on;
%figure('name','Standard Deviation');imshow(SD);
pixval on;
%%%%%%%%%%%%%%%%%%%%%
%Third :Start using the Fuzzy System FIP1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Fill_IMG=size(im); %making a
matrix the same size as input image
a=readfis('FIP1');
for x=2:Xim-1
for y=2:Yim-1
%1-Gradient:(scaling for pixels to be between 0->100 by
multiplying each pixel with
%100/maxvalueofimage
G(x,y)=(G(x,y)*100)/Gmaxval;
%2-standard deviation: (scaling for pixels to be between 0-
>100 by multiplying each pixel with
%100/maxvalueofimage
SD(x,y)=(SD(x,y)*100)/SDmaxval;
%3-applying fuzzy /system
output=evalfis([SD(x,y) G(x,y)],a);% takes input
if output >0.5 %the threshold value =0.5
Fill_IMG(x,y)=1; % edge
else
Fill_IMG(x,y)=0;% not edge
end
end
end
figure('name','Processed Image');imshow(Fill_IMG);
end



RSS News Feed