use evalfis to read input under a range

6 次查看(过去 30 天)
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 个评论
Iman Ansari
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
leow 2013-8-10
Hi,
I put the input as k1(:) l1(:) z1(:). Is that i cannot use that as input although I already declare the value of input by range in k1,l1 and z1 form? I have try to put input through and the output value can be show out. I have input [88 134 144] and it successfully show out the value. If like that, why when using ruleview the output can be show out but when i run the coding the output value only shows out the same value as when i open ruleviewer? Is that mean my input did not pass through the rule that i have been built up?
Thanks.

请先登录,再进行评论。

采纳的回答

Iman Ansari
Iman Ansari 2013-8-10
编辑:Iman Ansari 2013-8-10
In your code, input isn't same as [88 134 144]. They are logical (0,1):
evalfis([88 134 144])
but:
evalfis([0 1 1])
Maybe, this is what you want:
clear;
A=imread('Linggi.tif');
[m n p]=size(A);
r=A(:,:,1);
g=A(:,:,2);
b=A(:,:,3);
Y=readfis('mam.fis');
Mask = r > 88 & r <= 90 & g > 134 & g <= 140 & b > 144 & b <= 145;
k1=r(Mask);
l1=g(Mask);
z1=b(Mask);
Output = evalfis([k1 l1 z1],Y);
Result = A;
Result(Mask) = Output;
  19 个评论
Iman Ansari
Iman Ansari 2013-8-11
编辑:Iman Ansari 2013-8-11
I used these 3 lines for testing the code, you don't need these lines.
A1 = uint8(zeros(10,10,3));
Mask = logical(randi([0 1],10,10));
Output = rand(nnz(Mask),1)*6.5;
leow
leow 2013-8-11
Hi, Thanks, the image can display out different color at different output range already. If I want to input other range, mask1=r > 928 & r <= 100 & g > 147 & g <= 150 & b > 134 & b <= 150; and the result use the same output range that set before to display different color for different range, the part of k1=r(Mask); l1=g(Mask); z1=b(Mask); and im(Mask) = Output; how to edit?
Thanks.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Linear Programming and Mixed-Integer Linear Programming 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by