matlabimage-processingaffinetransformginput

Extracting actual pixel number from `ginput()`


I am using the following code on a given image:

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

I am getting a non-integer relative number.


Solution

  • 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.