Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

How to get the coordinates of the point that the mouse touch?

When my mouse touch the picture that the Mathematica touch ,I hope it can return the coordinates?

share|improve this question
    
Right click - Get Coordinates? –  Öskå Sep 15 '13 at 11:57
    
Or ExampleData[{"TestImage", "Lena"}] and then: ` Dynamic[MousePosition["Graphics"]]` –  Pinguin Dirk Sep 15 '13 at 11:58

1 Answer 1

There are two options to interactively extract the pixel location. As suggested by Oska, you can right click on the image and choose Get Coordinates. This returns the coordinates with the origin at the lower left of the image, as if one were using a plot command. Or, you can right click on the image and choose "Get Indices`, which returns the indices in row/column form of the image with the origin at the upper left of the image, as if one indexing into a matrix. You can read about why this dual-indexing exists here.

If operating programmatically, then the command MousePosition accomplishes much the same thing, as suggested by Pinguin Dirk.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.