Prev: Problem with
Next: A development platform for implementation of hardware-in-the-loop real-time control systems
From: Eric on 11 Jan 2010 17:22 I'm having the same problem. cpselect is designed for two images, but I'd really like to define points on just one. I tried using [xy1, xy2] = cpselect(W_L.Map, zeros(10,10),'Wait',true) but xy1 and xy2 are both empty unless I select points on both of the images in cpselect (i.e., the desired one and the "black" one I passed it). I could select meaningless points on the 10x10 zeros matrix, but I'm developing a tool others will use and want to avoid anything so kludgy. The other thing I've done previously for creating multiple, draggable points on a single image is to create multiple datatips and then get their locations when a button in a GUI is clicked. This isn't going to work well for what I'm working on now, either. I guess I'll put in a request for cpselect() to function on just a single image rather than a pair. This would make it more useful when more than two images are to be registered. -Eric
From: Alex Taylor on 14 Jan 2010 16:59 "tomer flo" <tomer_fl(a)yahoo.com> wrote in message <hdfa5d$3f2$1(a)fred.mathworks.com>... > Hi, > I have an image and the user has to click anywhere and select a point by mouse-clicking. I want to get the co-ordinates of the selected point. > I am using the "impoint" function however I can't get the co-ordinates of the point... > I am trying to get the co-ordinates by using the "getPositiong" however it doen't work > Can anyone help me out with what to do.. > the code is attached... > > figure, imshow('pout.tif'); > h1 = impoint(gca, []); > pos = getPosition(h1); > > thanking in advance! Tomer, The code segment above will work in MATLAB versions 8a and later. In prior versions, there is an extra step required to access the impoint API. Try executing the following: figure; imshow('pout.tif'); hpoint = impoint(gca,10,100); api = iptgetapi(hpoint); api.getPosition(); Hope this helps, Alex.
From: Michael on 3 Feb 2010 08:21
"Alex Taylor" <iamanonster(a)gmail.com> wrote in message <hio439$l3r$1(a)fred.mathworks.com>... > "tomer flo" <tomer_fl(a)yahoo.com> wrote in message <hdfa5d$3f2$1(a)fred.mathworks.com>... > > Hi, > > I have an image and the user has to click anywhere and select a point by mouse-clicking. I want to get the co-ordinates of the selected point. > > I am using the "impoint" function however I can't get the co-ordinates of the point... > > I am trying to get the co-ordinates by using the "getPositiong" however it doen't work > > Can anyone help me out with what to do.. > > the code is attached... > > > > figure, imshow('pout.tif'); > > h1 = impoint(gca, []); > > pos = getPosition(h1); > > > > thanking in advance! > > Tomer, > > The code segment above will work in MATLAB versions 8a and later. In prior versions, there is an extra step required to access the impoint API. > > Try executing the following: > > figure; imshow('pout.tif'); > hpoint = impoint(gca,10,100); > api = iptgetapi(hpoint); > api.getPosition(); > > Hope this helps, > > Alex. I'm not sure if this thread was ever solved, but I'm doing a similar thing. The way I produce the points on my image is to get the current point of the image axes, then set the impoint from that: currentPoint = get(handles.imageAxes, 'CurrentPoint'); thePoint = impoint(gca,currentPoint(1), currentPoint(3)); Put this in a buttonDownFcn that you attach to the image handle and you'll be all set. If you don't display an image on the axes you can attach the buttonDownFcn directly to the axes. Otherwise do: handles.imageHandle = imshow(displayImage); set(handles.imageHandle, 'ButtonDownFcn', {@image_ButtonDownFcn, handles}); |