运行matlab程序出现错误 Undefined function 'uiopen' for input arguments of type 'char'

在运行下面这个程序: a=imread('eclipse.png'); a=rgb2gray(a); a=double(a); sz=5; T1=0.2; T2=0.6; h=fspecial('gaussian',sz,sz/6); a=imfilter(a,h,'replicate'); a=double(a); GX=[-1, 0, 1; -2, 0, 2; -1, 0, 1]; % Gx GY=[1, 2, 1; 0, 0, 0; -1, -2, -1]; % Gy I1=imfilter(a,GX,'replicate'); I2=imfilter(a,GY,'replicate'); g=sqrt(I1.^2+I2.^2); [x,y]=size(a); theta= atan2 (I2, I1); theta = theta*180/pi;% compute the edge direction image theta(x,y) % set the direction's range to be [0,360] for i=1:x for j=1:y if (theta(i,j)<0) theta(i,j)=360+theta(i,j); end; end end % quantize the angle to the nearest angle:{0,45,90,135,180,225,270,315,360} for i = 1:x for j = 1:y if ((theta(i, j) >= 0 ) && (theta(i, j) < 22.5) || (theta(i, j) >= 157.5) && (theta(i, j) < 202.5) || (theta(i, j) >= 337.5) && (theta(i, j) <= 360)) theta(i, j) = 0; elseif ((theta(i, j) >= 22.5) && (theta(i, j) < 67.5) || (theta(i, j) >= 202.5) && (theta(i, j) < 247.5)) theta(i, j) = 45; elseif ((theta(i, j) >= 67.5 && theta(i, j) < 112.5) || (theta(i, j) >= 247.5 && theta(i, j) < 292.5)) theta(i, j) = 90; elseif ((theta(i, j) >= 112.5 && theta(i, j) < 157.5) || (theta(i, j) >= 292.5 && theta(i, j) < 337.5)) theta(i, j) = 135; end; end; end; [x,y]=size(g); figure,imshow(g); figure,imshow(theta); result=zeros(x,y); % perform the nonmaximal supression. for i=2:x-1 for j=2:y-1 if (theta(i,j)==0) result(i,j) = (g(i,j) == max([g(i,j), g(i,j+1), g(i,j-1)])); elseif (theta(i,j)==45) result(i,j) = (g(i,j) == max([g(i,j), g(i+1,j-1), g(i-1,j+1)])); elseif (theta(i,j)==90) result(i,j) = (g(i,j) == max([g(i,j), g(i+1,j), g(i-1,j)])); elseif (theta(i,j)==135) result(i,j) = (g(i,j) == max([g(i,j), g(i+1,j+1), g(i-1,j-1)])); end; end; end; result = result.*g; figure, imshow(result); G=uint8(result); imshow(G); G(G>T2*max(G(:)))=255; % change the pixels above upper threshold to be edges. G(G0 & G<255))~=[1 0]) for i=2:x-1 for j=2:y-1 if (G(i,j)>0 && G(i,j)<255) if (G(i-1,j-1)==255 || G(i-1,j)==255 || G(i-1,j+1)==255 || (G(i,j-1)==255) || (G(i,j+1)==255) ||(G(i+1,j-1)==255) || G(i+1,j)==255 || G(i+1,j+1)==255) G(i,j)=255; end end end end n=n+1; if(n==2) break; end end G(find(G>0 & G<255))=0; result=im2bw(G); % change the image, which only has intensity of 0 and 255, to a binary image. figure,imshow(G); 出现这个错误: Undefined function 'uiopen' for input arguments of type 'char' 怎们办? 求高人指点!!!!!!
请先 登录 后评论

2 个回答

LinHan.ee
存在自定义函数uiopen,请找一下uiopen.m拷贝到当前目录下再运行
请先 登录 后评论
flewer
enen
请先 登录 后评论