2
我建立一个Matlab GUI,该GUI让用户使用一些交互式工具用于图像处理(不具有图文件中的单个M文件)的工具栏,
像imrotate
的图像的旋转和角参数和用bwareaopen
和区域参数清除像素。matlab的GUI与M文件
起初,我想用我的M文件与somehthing绘制工具,如
function myGUI(grayI)
h_fig = figure;
h_ax = imshow(grayI);
title('Drag line and press button to rotate image');
ImgSize = size(grayI);
h_lev = imline(gca, [ 0.2*ImgSize(2), 0.1*ImgSize(1); ...
0.8*ImgSize(2) 0.1*ImgSize(1) ]);
h_lev.addNewPositionCallback(@LineUpdateFcn);
% text for the angle
h_txt = uicontrol('Style','text','String','Angle = []', 'unit', 'norm', ...
'pos',[0 0.9 .1 .05]);
%add rotate button
h_btn = uicontrol('unit','norm','pos',[0 0.95 .1 .05]);
set(h_btn,'string','Rotate','callback',@RotateImageWithLever);
% save the elements data in figure
setappdata(h_fig,'h_lev',h_lev);
setappdata(h_fig,'h_ax',h_ax);
setappdata(h_fig,'h_txt',h_txt);
% wait for user to close figure
waitfor(h_fig);
,但那时,我发现工具栏的设计都为内置类FileExchange Fireworks和想,也许我错过以正确和简洁的方式设计我的工具栏的类和内置uitoolbar
命令。
从单个mfile设计我的工具栏的任何建议?