1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| function test
fig = figure('units','pixels',...
'position',[250 250 500 500],...
'color',[1 1 1],...
'numbertitle','off',...
'name','Exemple',...
'menubar','none',...
'tag','interface');
h = uimenu('Label','File');
uimenu(h,'Label','Load', ...
'Callback',@myopenfile);
uimenu(h,'Label','Quit', ...
'Callback',@exit, ...
'Separator','on', ...
'Accelerator','Q');
% bouton sensé calculer les attributs de l'image en faisant appel à la fct try22D
uicontrol('style','pushbutton',...
'units','normalized',...
'position',[0.1 0.1 0.4 0.05],...
'string','calcul des attributs',...
'callback', @try22D,...
'tag','calcul');
handles.axes = subplot(1,2,2);
handles.valeurs = [2 0];
guidata(fig,handles);
function myopenfile(obj,event)
handles = guidata(gcbf);
[filename,pathname] = uigetfile;
filename = fullfile(pathname,filename);
I = imread(filename);
axes(handles.axes);
imshow(I);
handles.fichier = filename;
guidata(gcbf,handles)
function try22D(obj,event)
handles = guidata(gcbf);
handles.valeurs
handles.fichier |
Partager