-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoggle.m
35 lines (29 loc) · 804 Bytes
/
toggle.m
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
function toggle(im1, im2)
n = 0;
% Loop, picking up the points.
disp('any mouse button toggles images')
disp('press any key to stop')
but = 0;
%figure;
n=1;
hFig = figure;
hIm = imshow(im1,[],'InitialMagnification',100);
hSP = imscrollpanel(hFig,hIm);
api = iptgetapi(hSP);
while but == 0
if(n==1)
%imshow(im1,[],'InitialMagnification',100, 'border','tight');axis image;axis off;
%imshow(im1,[]);axis image;axis off;
api.replaceImage(im1,[]);
n=2;
else
%imshow(im2,[],'InitialMagnification',100, 'border','tight');axis image;axis off;
%imshow(im2,[]);axis image;axis off;
api.replaceImage(im2,[]);
n=1;
end;
w = waitforbuttonpress;
if w ~= 0
break
end
end