error in evalfis..

this FIS takes 4 inputs...this is the following code:
a=imread('Lenna.png');
gg=rgb2gray(a);
h=imresize(gg,[50 50]);
[m,n]=size(h);
figure, imshow(h)
t=readfis('ed2.fis');
%z=zeros([m n]);
for i=2:m
for j=2:n
p4=g(i,j);
p1=g(i-1,j-1);
p2=g(i,j-1);
p3=g(i-1,j);
g(i,j)=evalfis([p1 p2 p3 p4],t);
end
end
imshow(g)
the error is: The first input must be a defined DOUBLE matrix
Error in ==> evalfis at 84 [output,IRR,ORR,ARR] = evalfismex(input, fis, numofpoints);
Error in ==> ed2x2 at 18 g(i,j)=evalfis([p1 p2 p3 p4],t);
but the problem is i dont want to convert the image to class double.. what do i do?

 採用された回答

Geoff
Geoff 2012 年 3 月 30 日

0 投票

Why don't you want to convert it to double? It's not like it's going to be huge.
You don't have to replace your uint8 image either:
h = imresize(gg,[50 50]);
dh = double(h);
By the way, in your loop you are using p4 as an input but it hasn't been calculated yet. Did you mean to take the p-values from your h-matrix, rather than your g-matrix?
Anyway, if that was the intent, just take p from dh instead of h

2 件のコメント

Geoff
Geoff 2012 年 3 月 30 日
Oh, and of course, convert back to uint8 to store in g. And it would pay to preallocate g:
g = uint8(zeros(m,n))
mideas
mideas 2012 年 3 月 30 日
oh ya..m actually taking the p-values from the h-matrix. (i wrote it wrong out here...sorry). and thanx a lot..its working now..

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeFuzzy Logic Toolbox についてさらに検索

質問済み:

2012 年 3 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by