"WindowButtonMotionFcn and Current Points For an Image": How can i access the tracked values (Current Points x and Y) for further analysis.

5 views (last 30 days)
Below is my attempt. I can plot the current points but can't get them stored into a variable.
I believe it has to do with storing them as XData or YData, with proper axis handles. But i'm really breaking my heads for a week now to get it right. I tried using 'GTrack', 'MouseTrack' (works well only if i use imagesc) and similar files from file-exchange. They all helped me to get a better understanding of mouse tracking and plot, but don't output the X and Y variables.
(P.S: Right now going through the 41 GUI examples by MATT)
Appreciate any hint or any links that can help my cause.
Thanks!
Arun.
%%%%%%%
function test
fig= figure();
imshow(imROI); axis on; hold on;
set(gcf,'Pointer','crosshair');
set(gcf,'WindowButtonDownFcn',@wbdcb);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
function wbdcb (varargin)
set(gcf,'WindowButtonMotionFcn',@wbmcb);
end
function wbmcb(varargin)
cp=get(gca,'CurrentPoint'); cp=round(cp);
col=cp(1,1); row=cp(1,2);
set (gcf,'WindowButtonUpFcn',@wbucb);
plot(col,row,'y.');
drawnow
% save('test.mat','cpt');
end
function wbucb(varargin)
set(gcf,'WindowButtonDownFcn','');
close all;
end

Answers (0)

Categories

Find more on Graphics Performance in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!