Extracting actual pixel number from `ginput()`

234 views Asked by At

I am using the following code on a given image:

imshow(image);
[out1,out2]=ginput(1);

I am getting a non-integer relative number.

  • How do I extract the exact pixel numbers in (row,column) from the output of ginput().
  • I want to, later on, generate an affine transformation matrix (using estimateGeometricTransform()) to move points in one image to a second image. should I use the pixel number or the regular output of ginput()?
1

There are 1 answers

0
Adriaan On BEST ANSWER

ginput gives you relative positions, so

round(ginput(1))

should get you to the centre of the pixel, which is what you'll probably want, as it's difficult to select matching features on a level finer than pixels. If you can select features on a level finer than pixels, you should of course use that, and do that for both images.