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 55 56 57
|
function test_segmentation()
clc
clear all
close all
%-------------------------------------
% CHARGER IMAGE
[I map]= imread('coins.png');
I1 = double(I);
maxPTS = [];
%---------------------------
% GUI
Fig_handle = figure(1);
imshow(I) % IMAGE
% CURSEUR : collecter données
datacursormode on
dcm_obj = datacursormode(Fig_handle);
set(dcm_obj,'UpdateFcn',@myupdatefcn)
% BOUTTON : Execute
run_boutton = uicontrol('style','pushbutton',...
'units','normalized',...
'position',[0.25 0.01 0.45 0.05],...
'string','Execute',...
'callback',@run_algo,...
'tag','b_run');
fprintf('Done !! \n')
%----------------------------------------------
% Nested Functions
function run_algo(obj,event)
%----------------------------
% Executer Le Traitement
maxPTS % EXEMPLE : Afficher la liste des max
end
function txt = myupdatefcn(empt,event_obj)
pos = get(event_obj,'Position');
txt = {['i: ',num2str(pos(1))],...
['j: ',num2str(pos(2))]};
if ~ismember(pos(1,1:2), maxPTS, 'rows')
maxPTS = [maxPTS; pos(1) pos(2)];
end
end
end |
Partager