How to use an impoint?
Show older comments
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 Comment
karan padariya
on 28 Jun 2022
imshow(image,'Parent',app.UIAxes);hold on;
adding this in your code might work
Answers (1)
Chad Gilbert
on 19 Jul 2013
See help ginput. A minimal working example:
pcolor(rand);
[x,y] = ginput(1);
% User clicks a value.
x = floor(x);
y = floor(y);
7 Comments
Pani
on 19 Jul 2013
Edited: Image Analyst
on 19 Jul 2013
Caleb
on 19 Jul 2013
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
on 19 Jul 2013
Caleb
on 19 Jul 2013
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
on 19 Jul 2013
Caleb
on 19 Jul 2013
When I'm using impoint() the points are draggable. Is there some way you can post a sample of your code?
Pani
on 19 Jul 2013
Categories
Find more on Data Exploration in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!