简体   繁体   English

MATLAB GUI:如何获取鼠标单击坐标(需要更多详细信息!)

[英]MATLAB GUI: how to get mouse click coordinates(need more help on details!)

I am trying to gat the x,y coordinate of the image I loaded in axes by clicking the mouse. 我试图通过单击鼠标来调整我在轴中加载的图像的x,y坐标。 I've seen a few answers, such as this one MATLAB how to get mouse click coordinates My questions is where(under which function?) should I put the 我已经看到了一些答案,例如这个MATLAB如何获取鼠标单击坐标。我的问题是应该放在哪里(在哪个函数下?)。

imageHandle = imshow(imageObj);

as well as 以及

set(imageHandle,'ButtonDownFcn',@ImageClickCallback);

Sorry for this naive question, Thanks! 很抱歉这个幼稚的问题,谢谢!

I've had good success using the "impixel" function as a way to detect x,y coordinates. 我使用“ impixel”功能作为检测x,y坐标的方法取得了成功。 I would give this a shot: 我可以试一下:

imageHandle = imshow(imageObj);
[clicked_col clicked_row rgb_info] = impixel

Note: impixel allows multiple clicks. 注意:impixel允许多次点击。 Press "Enter" to return the x,y info once you're done clicking. 单击完成后,按“ Enter”返回x,y信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM