【发布时间】:2014-05-13 12:39:29
【问题描述】:
我想在此代码中添加一个按钮,该按钮将关闭窗口并在我旋转时保存图片。
function rotationGUI(a)
I = imread(a);
%# c
hFig = figure('menu','none');
hAx = axes('Parent',hFig);
uicontrol('Parent',hFig, 'Style','slider', 'Value',0, 'Min',0,...
'Max',360, 'SliderStep',[1 10]./360, ...
'Position',[150 5 300 20], 'Callback',@slider_callback)
hTxt = uicontrol('Style','text', 'Position',[290 28 20 15], 'String','0');
%# show image
imshow(I, 'Parent',hAx)
%# Callback function
function slider_callback(hObj, eventdata)
angle = round(get(hObj,'Value')); %# get rotation angle in degrees
imshow(imrotate(I,angle), 'Parent',hAx) %# rotate image
set(hTxt, 'String',num2str(angle)) %# update text
end
function ok_Callback(hObject, eventdata, handles)
set(hTxt, 'String','save')
end
end
【问题讨论】:
标签: matlab user-interface image-processing matlab-guide