Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: GUI Current pointer location on displayed image
Replies: 2   Last Post: Nov 6, 2009 8:31 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Richard

Posts: 3
Registered: 11/6/09
Re: GUI Current pointer location on displayed image
Posted: Nov 6, 2009 7:34 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Richard " <rjtennant@greeneridge.com> wrote in message <hcvctn$4qa$1@fred.mathworks.com>...
> Ran into a little problem with my GUI program today. I would like eventually to create lines and boxes on top of a displayed image. Any help or reference to websites or functions would be much appreciated.
>
> Here's what I did if you are trying to recreate the problem. Using guide create an axes tagged as Picture. Then in the m-editor under the function that executes before figure is made visible, display a jpeg on the axes...
>
> axes(handles.Picture)
> image(imread('Picture.jpg')) %loads and displays Picture.jpg
>
> Now I want to set up a click-able box using ButtonDownFcn or WindowButtonDownFcn(preferably the previous ButtonDownFcn) , WindowMotionFcn and WindowButtonUpFcn.
>
> I run into a problem with getting my mouse position on the image,
> "There is no 'CurrentPoint' property in the 'image' class"
> Seems like there should be a way of getting mouse location without ginput for an image because you can do it for a normal plot...
> I'm using 2007b btw


I am pretty new to OOP and GUI programming and after a day more of research, I found a workable solution. The point was realizing that the image was a child of the figure and the only child in this case, so get(get(gcf,'Children'),'CurrentPoint') gave me the current mouse position. Hope this helps someone!



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2009. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Goodwin College of Professional Studies.