how can i snap the specific data point?
6 views (last 30 days)
Show older comments
min hao
on 21 Jun 2018
Commented: Walter Roberson
on 27 Jun 2018
I have written a GUI program. The program wants to recognize some features in the face. And first, I have initialized some original features. the next stage is that I want to adjust the position of the points by manual. therefore, I need to snap the specific point automatically.at the meanwhile, I refresh the image and show the position of these features each change. I have researched for a week now. but I cannot find the answers. so I need your comments.thank you.
2 Comments
Walter Roberson
on 21 Jun 2018
I am not sure what you mean by "I need to snap the specific point automatically", but I suspect you want to do Image Registration https://www.mathworks.com/discovery/image-registration.html
Accepted Answer
Walter Roberson
on 22 Jun 2018
To move the mouse to a location, see https://www.mathworks.com/matlabcentral/answers/100545-how-can-i-programmatically-control-mouse-motion-and-clicks-with-matlab
12 Comments
Walter Roberson
on 27 Jun 2018
jmouseemu does not accept image objects for the coordinate system.
You can find the location of the image within the axes by getting the image XData and YData properties. Those values are the locations of the centers of the lower left and upper right pixels, in Data coordinates. To move to a particular pixel location you would need to get the axes XLim and YLim properties, and get the CData property so that you can figure out how many pixels wide and tall the image was, so that you can figure out the conversion the pixel width in data units and the offset needed for the center to edge. You would work with the axes InnerPosition property for the next step.
You might find it easier to use https://www.mathworks.com/matlabcentral/fileexchange/10656-data-space-to-figure-units-conversion -- but you still need to take into account that the coordinates are of centers of pixels not edges.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!