use evalfis to read input under a range

조회 수: 3 (최근 30일)
leow
leow 2013년 8월 9일
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에서 Image Processing and Computer Vision에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by