use evalfis to read input under a range

6 visualizzazioni (ultimi 30 giorni)
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 Commenti
Iman Ansari
Iman Ansari il 10 Ago 2013
Modificato: Iman Ansari il 10 Ago 2013
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 il 10 Ago 2013
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.

Accedi per commentare.

Risposta accettata

Iman Ansari
Iman Ansari il 10 Ago 2013
Modificato: Iman Ansari il 10 Ago 2013
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 Commenti
Iman Ansari
Iman Ansari il 11 Ago 2013
Modificato: Iman Ansari il 11 Ago 2013
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 il 11 Ago 2013
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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Linear Programming and Mixed-Integer Linear Programming in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by