getpts
needs a handle to either a figure or an axes, not a matrix as given by imread
.
The simple solution is to display the image, then input either gca
or gcf
to getpts
. Or you can manage handles on your own, but I don't think you wan't to do that.
Or to put it on one line with imshow
:
[X,Y] = getpts(get(imshow('xyz.jpg'),'Parent'));