How to use an impoint?

I want to use impoint in the gui that I've created, but I don't know how should I do that. There is a part in my gui that the user should be able to choose 2 pixel on the loaded image and then the program runs another function with the coordinates of those 2 pixels. I want also that the program updates the coordinates when the user changes that points.

1 件のコメント

karan padariya
karan padariya 2022 年 6 月 28 日
imshow(image,'Parent',app.UIAxes);hold on;
adding this in your code might work

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

回答 (1 件)

Chad Gilbert
Chad Gilbert 2013 年 7 月 19 日

0 投票

See help ginput. A minimal working example:
pcolor(rand);
[x,y] = ginput(1);
% User clicks a value.
x = floor(x);
y = floor(y);

7 件のコメント

Pani
Pani 2013 年 7 月 19 日
編集済み: Image Analyst 2013 年 7 月 19 日
I'm sooooo new in Matlab, I already read the help but I still don't know how to do that. I did this but it's not what I want, I need a draggable point with impoint.
[x,y] = ginput(2)
handles.X = x;
handles.Y = y;
guidata(handles.PixelSelectionButt,handles)
[Xpath Ypath] = catetherPathFast((1-VessN).*im2double(I),y,x);
axes(handles.ShowImage);
hold on
plot(Ypath,Xpath,'b-');
hold off
Caleb
Caleb 2013 年 7 月 19 日
Read the documentation on the ginput() function. The coordinates of your mouse click are saved in variables x and y.
ginput(1) means you only want to save the location of one mouse click. If you replace the 1 with a 2, then you'll save the location of two mouse clicks. And so on...
Pani
Pani 2013 年 7 月 19 日
I already used ginput, I don't have any problem with it, my problem is that I should use the impoint! and the points should be draggable!
Caleb
Caleb 2013 年 7 月 19 日
I'm thinking that you understand how impoint() works then from the documentation. I assume then that something is not updating correctly when you move the points again. Is that correct?
Pani
Pani 2013 年 7 月 19 日
No, my problem is that the points are not draggable!
Caleb
Caleb 2013 年 7 月 19 日
When I'm using impoint() the points are draggable. Is there some way you can post a sample of your code?
Pani
Pani 2013 年 7 月 19 日
I did, in my first comment

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

カテゴリ

ヘルプ センター および File ExchangeData Exploration についてさらに検索

質問済み:

2013 年 7 月 19 日

コメント済み:

2022 年 6 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by