Input argument "image" is undefined??how to resolve this??

3 ビュー (過去 30 日間)
Saranya
Saranya 2014 年 3 月 13 日
回答済み: Dishant Arora 2014 年 3 月 13 日
function m=feature1(image)
i=imread(image);
i=rgb2gray(i);
i1=graycomatrix(i,'offset',[0 1], 'Symmetric', true);
i2=graycomatrix(i,'offset',[-1 1], 'Symmetric', true);
i3=graycomatrix(i,'offset',[-1 0], 'Symmetric', true);
i4=graycomatrix(i,'offset',[-1 -1], 'Symmetric', true);
e1=graycoprops(i1,{'contrast','homogeneity','energy','correlation'});
e2=graycoprops(i2,{'contrast','homogeneity','energy','correlation'});
e3=graycoprops(i3,{'contrast','homogeneity','energy','correlation'});
e4=graycoprops(i4,{'contrast','homogeneity','energy','correlation'});
en=entropy(i1);
en1=entropy(i2);
en2=entropy(i3);
en3=entropy(i4);
s=struct2cell(e1);
s=cell2mat(s);
s=s';
s1=struct2cell(e2);
s1=cell2mat(s1);
s1=s1';
s2=struct2cell(e3);
s2=cell2mat(s2);
s2=s2';
s3=struct2cell(e4);
s3=cell2mat(s3);
s3=s3';
s4=[s s1 s2 s3];
a=imread(image);
a=rgb2gray(a);
a1=rgb2hsv(a);
m1=mean(a1);
d=std(a1);
sk=skewness(a1);
imi=edge(i,'canny');
G = fspecial ('gaussian');
N=length(G);
[Gh,Gv] = gradient(G);
imx = conv2(double(i),Gh);
imx = imx ((N-1)/2+1:size(imx,1)-(N-1)/2,(N-1)/2+1:size(imx,2)-(N-1)/2);
imy = conv2(double(i),Gv);
imy = imy ((N-1)/2+1:size(imy,1)-(N-1)/2,(N-1)/2+1:size(imy,2)-(N-1)/2);
%%gra_mag = sqrt(imx.^2+imy.^2);
gra_dir = atan2(imy,imx);
ed=edgedirection5(imi,gra_dir);
ed1=ed./(sum(ed)*2);
a2=imread(image);
a2=rgb2gray(a2);
a2=im2bw(a2);
mo=shape1(a2);
%[m2 m3 m4 m5 m6 m7 m8]=shape(a2);
%mo=double(mo);
m=[s4 en en1 en2 en3 m1 d sk ed1 mo];
m=m';

回答 (1 件)

Dishant Arora
Dishant Arora 2014 年 3 月 13 日
did you run it as script?? or did you call the function with proper input arguments, like:
Output = feature1(imageArray)

Community Treasure Hunt

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

Start Hunting!

Translated by