0

In order to classify remote sensing image by using k-means method in matlab, I want to select some samples in an image with an mouse clicking on it, but I don't know how to code that, could you tell me some method to accomplish it?

Delimitry
  • 2,987
  • 4
  • 30
  • 39
tanjing
  • 81
  • 2
  • 8
  • have you tried `Data Cursor` in the toolbar of the figure? – Gnimuc Jul 25 '15 at 08:54
  • Have a look at this [answer](http://stackoverflow.com/questions/28003365/matlab-gui-axes-extract-position-from-datacursor/28003681#28003681), you could re-use the base method. Or simply look at the function [`ginput`](http://mathworks.com/help/matlab/ref/ginput.html) – Hoki Jul 25 '15 at 11:53

1 Answers1

2

you can use impoint, for example:

figure, imshow('pout.tif');
h = impoint(gca,[]);
position = wait(h);

this interactively place a point. Use wait to block the MATLAB command line. Double-click on the point to resume execution of the MATLAB command line. position is specifying the coordinates of the point [X Y].

bla
  • 25,846
  • 10
  • 70
  • 101