evalfis error
조회 수: 4 (최근 30일)
이전 댓글 표시
hi.. the fuzzy inference system 'a' takes 3 inputs. function RGB2Lab is already defined. the following is the code in which the FIS has to evaluate the l,a,b values of the image.
z=imread('Lenna.png');
x=readfis('a.fis');
s=imresize(z,[128 128]);
R=s(:,:,1);
G=s(:,:,2);
B=s(:,:,3);
[L,a,b]=RGB2Lab(R,G,B);
[m,n]=size(s);
Ld=double(L);
ad=double(a);
bd=double(b);
for i=1:m
for j=1:n
q=evalfis([Ld ad bd],x);
end
end
the error shown is: Error using ==> evalfis The first argument should have as many columns as input variables and as many rows as independent sets of input values.
Error in ==> ch at 22 q=evalfis([Ld ad bd],x);
can anyone please help me correct it..
댓글 수: 0
채택된 답변
Walter Roberson
2012년 4월 3일
We can tell from your extraction of R, G, and B, that s is a 3 dimensional array. Your code line [m,n] = size(s) makes it look like a 2 dimensional array. There is meaning to that line, but it is not to extract just the first and second dimensions: when you use more than one output argument to size() and the number of output arguments is smaller than the number of dimensions, then the last output argument will be given a value which is the product of all the dimensions from there on.
Your nested "for" loops do not change any parameters in the call to evalfis(), so it is not clear why you are bothering to loop.
After your image resize, s will be 128 x 128 x 3 so [Ld ad bd] is going to be 128 x 384 . Is your fis set up to expect 128 input variables?
댓글 수: 3
Walter Roberson
2012년 4월 4일
How many input variables does the FIS expect? Is it intended to process column by column perhaps?
We know from the documentation what evalfis() is supposed to do in general, but we do not know what your a.fis contains so we cannot yet advise on how to modify your code.
추가 답변 (1개)
mideas
2012년 4월 4일
댓글 수: 5
Walter Roberson
2012년 4월 4일
After posting I realized I wasn't sure that this was correct. I would need to look further at fis models. Unfortunately that is not something I will have time to do today.
참고 항목
카테고리
Help Center 및 File Exchange에서 Fuzzy Logic in Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!