how can i snap the specific data point?

6 views (last 30 days)
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
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
min hao
min hao on 22 Jun 2018
like the image attached, I want to adjust the point manually. surely, I require the mouse to snap the marker automatically.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 22 Jun 2018
  12 Comments
min hao
min hao on 27 Jun 2018
Excuse me, sir. I have met another problem. That is, before i show an image, I create an axis object. and then we show the image with the command "imshow".it leads to a problem. I don't know the axis object has the same coordinate with the image coordinate. because when I use the jmouseemu, I cant snap the point in the image. I found the snap point is based on the axis coordinate system.so, how to change the coordinate to the image system?
Walter Roberson
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!