Hi
I am trying to make a Gui in which i load image in axes. User has to
click anywhere in the image and i have to know where he clicked. i.e I
want to get co-ordinates of the point of mouse-click.
I tried it out. I am getting points without image i.e. on blank axes.
But with image, nothing happens..
Can anyone help me out with what to do..
thanking in advance...
Subject: problem in getting point coordinates in gui
shailesh gupta <sha.gupta.88@gmail.com> wrote in message <7613d61e-d2a3-4f28-95be-428eb314332a@w24g2000prd.googlegroups.com>...
> Hi
> I am trying to make a Gui in which i load image in axes. User has to
> click anywhere in the image and i have to know where he clicked. i.e I
> want to get co-ordinates of the point of mouse-click.
> I tried it out. I am getting points without image i.e. on blank axes.
> But with image, nothing happens..
> Can anyone help me out with what to do..
>
> thanking in advance...
It works fine for me. Check that your code is similar to this:
where 5 is the number of points. if you use ginput you can take unlimited points, but the user has to press enter after the last point. also note, that you won't get the coordinates until all of the points have been taken (as far as I'm aware).
Subject: problem in getting point coordinates in gui
"Dave Brackett" <davebrackett@hotmail.com> wrote in message <gi3da6$ig9$1@fred.mathworks.com>...
> shailesh gupta <sha.gupta.88@gmail.com> wrote in message <7613d61e-d2a3-4f28-95be-428eb314332a@w24g2000prd.googlegroups.com>...
> > Hi
> > I am trying to make a Gui in which i load image in axes. User has to
> > click anywhere in the image and i have to know where he clicked. i.e I
> > want to get co-ordinates of the point of mouse-click.
> > I tried it out. I am getting points without image i.e. on blank axes.
> > But with image, nothing happens..
> > Can anyone help me out with what to do..
> >
> > thanking in advance...
>
> It works fine for me. Check that your code is similar to this:
>
> h=imread('image_file.jpg');
> figure
> image(h)
> [x,y]=ginput(5)
>
> where 5 is the number of points. if you use ginput you can take unlimited points, but the user has to press enter after the last point. also note, that you won't get the coordinates until all of the points have been taken (as far as I'm aware).
sorry just realised that you wanted it in a GUI. it is basically the same, but replaces 'figure' in the second line with 'axes(handles.axes1)' or whatever your axes tag is.
Tags for this Thread
Add a New Tag:
Separated by commas
Ex.: root locus, bode
What are tags?
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central.
Read the complete Terms prior to use.