use evalfis to read input under a range
显示 更早的评论
Hi,
May i know is there any coding can can be use for evalfis to read input under range or not? For my case:
A=imread('Linggi.tif');
[m n p]=size(A)
r=A(:,:,1);
g=A(:,:,2);
b=A(:,:,3);
Y=readfis('mam.fis');
for i = 1:m,
for j = 1:n,
k=r(i,j) > 88 & r(i,j) <= 90;
l=g(i,j) > 134 & g(i,j) <= 140;
z=b(i,j) > 144 & b(i,j) <= 145;
k1=double(k);
l1=double(l);
z1=double(z);
evalfis([k1 l1 z1],Y)
end
end
I find out that the output for all the row and column read are the same, which means the inference system did not run for the input.
Is that got another method of evalfis can be use for me to use to read input that contains range?
6 个评论
leow
2013-8-10
Iman Ansari
2013-8-10
Hi. I don't understand what you want to do but:
Output = zeros(size(r));
for i = 1:m,
for j = 1:n,
k=r(i,j) > 88 & r(i,j) <= 90;
l=g(i,j) > 134 & g(i,j) <= 140;
z=b(i,j) > 144 & b(i,j) <= 145;
k1=double(k);
l1=double(l);
z1=double(z);
Output(i,j) = evalfis([k1 l1 z1],Y);
end
end
% or
k= r > 88 & r <= 90;
l= g > 134 & g <= 140;
z= b > 144 & b <= 145;
k1=double(k);
l1=double(l);
z1=double(z);
Output = evalfis([k1(:) l1(:) z1(:)],Y);
Output = reshape(Output,[m n]);
leow
2013-8-10
Iman Ansari
2013-8-10
编辑:Iman Ansari
2013-8-10
Why your inputs are logical or zero and one? Check your fuzzy system in Rule Viewer:
Y = readfis('mam.fis');
ruleview(Y)
you can enter your inputs in the lower left of the rule viewer window in the input box then press enter:
[0 0 0]
[0 1 0]
[0 0 1]
leow
2013-8-10
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!