function fff=width(xxx)
s1='F:\主观评价\databaserelease2\gblur\img';
s2='.bmp';
s=[s1 xxx s2];
Y1=imread(s);
Y1=rgb2gray(Y1);
Y1=double(Y1);
BW=edge(Y1,'canny');
[hh ww]=size(Y1);
wid=zeros(hh,ww);
for i=2:hh-1
for j=2:ww-1
if BW(i,j)==1
if Y1(i,j-1)<Y1(i,j)
for k=2:20
if (j-k)<=0
break;
end
if Y1(i,j-k)>Y1(i,j-k+1)
break
end
end
else
for k=2:20
if (j-k)<=0
break;
end
if Y1(i,j-k)<Y1(i,j-k+1)
break;
end
end
end
if Y1(i,j+1)<Y1(i,j)
for g=2:20
if (j+g)>=ww
break;
end
if Y1(i,j+g)>Y1(i,j+g-1)
break;
end
end
else
for g=2:20
if (j+g)>=ww
break;
end
if Y1(i,j+g)<Y1(i,j+g-1)
break;
end
end
end
wid(i,j)=k+g;
end
end
end
num=sum(sum(BW));
fff=sum(sum(wid))/num;