Getting image coordinates on mouse cursor position

  • Follow


Hi
I have image displayed using imshow().
I want to get image x,y coordinates on the location where the mouse points, not clicked.
For example if mouse cursor is on pixel(230,120),then i want to get this position as output.
Urgent help needed guyz.
0
Reply Aamna 9/23/2010 4:45:21 AM

On 22/09/10 11:45 PM, Aamna wrote:

> I have image displayed using imshow().
> I want to get image x,y coordinates on the location where the mouse
> points, not clicked.
> For example if mouse cursor is on pixel(230,120),then i want to get this
> position as output.
> Urgent help needed guyz.

Go in to the Matlab interactive documentation and search for CurrentPoint

0
Reply Walter 9/23/2010 4:53:29 AM


Walter Roberson <roberson@hushmail.com> wrote in message <d3Bmo.362$qb.309@newsfe12.iad>...
> On 22/09/10 11:45 PM, Aamna wrote:
> 
> > I have image displayed using imshow().
> > I want to get image x,y coordinates on the location where the mouse
> > points, not clicked.
> > For example if mouse cursor is on pixel(230,120),then i want to get this
> > position as output.
> > Urgent help needed guyz.
> 
> Go in to the Matlab interactive documentation and search for CurrentPoint
 
Thanx 4 ur help Sir but current point only works when mouse is clicked whereas i want its position while its just moving not clicked .
Any helpful function for that??
0
Reply Aamna 9/23/2010 7:29:10 AM

On 23/09/10 2:29 AM, Aamna wrote:

> Thanx 4 ur help Sir but current point only works when mouse is clicked
> whereas i want its position while its just moving not clicked .
> Any helpful function for that??

I don't know off-hand; I haven't had a need for that. I know it has been 
discussed here a few times before.

One approach would be to use a WindowButtonMotionFcn callback on the 
figure, and each time the cursor was moved, store the current point in 
some location. When you want to know where you are, retrieve the current 
contents of that location. You might have to adjust for differences 
between figure coordinates and axes coordinates.
0
Reply Walter 9/24/2010 2:56:19 PM

Walter Roberson <roberson@hushmail.com> wrote in message <n_2no.2322$Ki.1015@newsfe17.iad>...
> On 23/09/10 2:29 AM, Aamna wrote:
> 
> > Thanx 4 ur help Sir but current point only works when mouse is clicked
> > whereas i want its position while its just moving not clicked .
> > Any helpful function for that??
> 
> I don't know off-hand; I haven't had a need for that. I know it has been 
> discussed here a few times before.
> 
> One approach would be to use a WindowButtonMotionFcn callback on the 
> figure, and each time the cursor was moved, store the current point in 
> some location. When you want to know where you are, retrieve the current 
> contents of that location. You might have to adjust for differences 
> between figure coordinates and axes coordinates.

Thanks Sir.:)
It works
0
Reply Aamna 9/29/2010 6:12:07 AM

4 Replies
980 Views

(page loaded in 0.086 seconds)

Similiar Articles:













7/19/2012 5:20:33 PM


Reply: