Tracking mouse position on figure

82 ビュー (過去 30 日間)
Harry
Harry 2013 年 7 月 1 日
コメント済み: Jonathan Cellere 2020 年 3 月 13 日
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
Image Analyst 2013 年 7 月 1 日
% 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
  1 件のコメント
Jonathan  Cellere
Jonathan Cellere 2020 年 3 月 13 日
This command helped me a lot, could you help me? I made a GUI application where I need to get the X, Y positions of a figure however I need to delimit that the cursor can only take the values ​​of the figure and not others such as a button that is next

サインインしてコメントする。

その他の回答 (1 件)

Pourya Alinezhad
Pourya Alinezhad 2013 年 7 月 1 日
you can use the function
[x,y] = ginput(4)

カテゴリ

Help Center および File ExchangeData Exploration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by