I have this program that work fine until it reach the evaluation indicating an evalfis error like Error using evalfismex
1 次查看(过去 30 天)
显示 更早的评论
clc;close all;clear all
Irgb = imread('greens.jpg');
Igray = rgb2gray(Irgb);
figure
image(Igray,'CDataMapping','scaled')
colormap('gray')
title('Input Image in Grayscale')
I = im2double(Igray);
Gx = [-1 1];
Gy = Gx';
Ix = conv2(I,Gx,'same');
Iy = conv2(I,Gy,'same');
figure
image(Ix,'CDataMapping','scaled')
colormap('gray')
title('Ix')
figure
image(Iy,'CDataMapping','scaled')
colormap('gray')
title('Iy')
fis = newfis('edgeDetection');
sx = 0.1; sy = 0.1;
fis = addvar(fis,'input','Ix',[-1 1]);
fis = addmf(fis,'input',1,'zero','gaussmf',[sx 0]);
fis = addvar(fis,'input','Iy',[-1 1]);
fis = addmf(fis,'input',2,'zero','gaussmf',[sy 0]);
wa = 0.1; wb = 1; wc = 1; ba = 0; bb= 0; bc = 0.7;
fis = addvar(fis,'output','Iout',[0 1]);
fis = addmf(fis,'output',1,'white','trimf',[wa wb wc]);
fis = addmf(fis,'output',1,'black','trimf',[ba bb bc]);
rulelist=[1 1 1 1 1; 0 0 2 1 1];
fis=addrule(fis,rulelist);
figure
subplot(2,2,1)
plotmf(fis,'input',1)
title('Ix')
subplot(2,2,2)
plotmf(fis,'input',2)
title('Iy')
subplot(2,2,[3 4])
plotmf(fis,'output',1)
title('Iout')
Ieval = zeros(size(I));
for ii = 1:size(I,1)
Ieval(ii,:) = evalfis([(Ix(ii,:));(Iy(ii,:))]',fis);
end
figure
image(I,'CDataMapping','scaled')
colormap('gray')
title('Original Grayscale Image')
figure
image(Ieval,'CDataMapping','scaled')
colormap('gray')
title('Edge Detection Using Fuzzy Logic')
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fuzzy Inference System Modeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!