h0=figure('toolbar','none',...
'position',[198 56 350 468],...
'name','图像分析');
h1=axes('parent',h0,...
'position',[0.25 0.45 0.5 0.5],...
'visible','off');
I=imread('rice.tif');
imshow(I)
k=0;
b1=uicontrol('parent',h0,...
'units','points',...
'tag','b1',...
'style','pushbutton',...
'string','图像轮廓图',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[20 100 60 20],...
'callback',[...
'cla,',...
'k=1;,',...
'I=imread(''rice.tif'');,',...
'imcontour(I)']);
b2=uicontrol('parent',h0,...
'units','points',...
'tag','b2',...
'style','pushbutton',...
'string','SOBEL边界图',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[100 100 60 20],...
'callback',[...
'cla,',...
'k=2;,',...
'I=imread(''rice.tif'');,',...
'BW=edge(I,''sobel'');,',...
'imshow(BW)']);
b3=uicontrol('parent',h0,...
'units','points',...
'tag','b3',...
'style','pushbutton',...
'string','CANNY边界图',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[180 100 60 20],...
'callback',[...
'cla,',...
'k=3;,',...
'I=imread(''rice.tif'');,',...
'BW=edge(I,''canny'');,',...
'imshow(BW)']);
b4=uicontrol('parent',h0,...
'units','points',...
'tag','b4',...
'style','pushbutton',...
'string','灰度调整',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[20 50 60 20],...
'callback',[...
'cla,',...
'k=4;,',...
'I=imread(''rice.tif'');,',...
'J=imadjust(I,[0.15 0.9],[0 1]);,',...
'imshow(J,64)']);
b5=uicontrol('parent',h0,...
'units','points',...
'tag','b5',...
'style','pushbutton',...
'string','图像柱状图',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[180 50 60 20],...
'callback',[...
'if k==0,',...
'figure,',...
'imhist(I,64),',...
'end,',...
'if k==1,',...
'imhist(I,64),',...
'end,',...
'if k==2,',...
'imhist(BW,64),',...
'end,',...
'if k==3,',...
'imhist(BW,64),',...
'end,',...
'if k==4,',...
'imhist(J),',...
'end']);
b6=uicontrol('parent',h0,...
'units','points',...
'tag','b6',...
'style','pushbutton',...
'string','关闭',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[100 50 60 20],...
'callback','close');
评论0