Slider using GUI in matlab (Image processing)
古いコメントを表示
Hi, I´ve got this program in Matlab. But I need to put it on a GUI to add other filters and stuff like that. I can´t make it work. Please help.
function GaussianSlider()
clear
clc
close all
handles.Image = imread('peppers.png');
handles.fig = figure;
handles.axes1 = axes('Units','pixels','Position',[50 100 400 400]);
handles.slider = uicontrol('Style','slider','Position',[50 50 400 20],'Min',3,'Max',15,'Value',3);
handles.Listener = addlistener(handles.slider,'Value','PostSet',@(s,e) gaussian_blur(handles));
imshow(handles.Image,'Parent',handles.axes1);
guidata(handles.fig);
function gaussian_blur(handles)
slider_value = round(get(handles.slider,'Value'));
h = fspecial('gaussian',slider_value,slider_value);
handles.Image=imfilter(handles.Image,h,'conv');
axes(handles.axes1);
imshow(handles.Image)
end
end
採用された回答
その他の回答 (2 件)
Image Analyst
2015 年 10 月 12 日
0 投票
Get rid of the "clear" line of code.
Image Analyst
2015 年 10 月 12 日
0 投票
Jose, you don't need to add a listener. Simply put a call to the blurring function in your callback for your slider. Here is a good example framework to get you started with GUIDE: http://www.mathworks.com/matlabcentral/fileexchange/24224-magic-matlab-generic-imaging-component
カテゴリ
ヘルプ センター および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
