Tracking mouse position on figure
181 views (last 30 days)
I'm looking for some way of turning a JPEG into a MATLAB figure (which I know how to do). And then be able click on the figure and have the x and y values of where I clicked go into the code as variables, so I can take them through some function. Then be able to update the image with a circle at the point where I clicked if the x and y values fulfil a certain criteria from the function.
Image Analyst on 1 Jul 2013
% Get x,y coordinates
[x, y] = ginput(1);
% x = column, not row. So use yourImage(y,x), not yourImage(x,y)!
See the FAQ for code examples on creating circles. http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F