Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: problem in getting point coordinates in gui
Date: Sun, 14 Dec 2008 16:58:03 +0000 (UTC)
Organization: Loughborough University
Lines: 23
Message-ID: <gi3dur$mmr$1@fred.mathworks.com>
References: <7613d61e-d2a3-4f28-95be-428eb314332a@w24g2000prd.googlegroups.com> <gi3da6$ig9$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1229273883 23259 172.30.248.38 (14 Dec 2008 16:58:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 14 Dec 2008 16:58:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1338633
Xref: news.mathworks.com comp.soft-sys.matlab:506911


"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.