From: diwakar sharma on
Statement:- I have to mark two points on an image, and get their coordinates(initial co-ordinates). Then I have to move the points and get their co-ordinates (final co-ordinates).


I am using the followinng code as of now:

[fname,fpath] = uigetfile('*.*');
i = imread([fpath fname]);
imshow(i);hold on;

if (size(i,3)>1)
i=rgb2gray(i);
end



[xi,yi] = ginput(2);

plot(xi,yi,'r.');

but the problem here is that if I use ginput then I cannot move the points to a new position;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


The second option is using the impoint and getPosition function,the following code is used:

[fname,fpath] = uigetfile('*.*');
i = imread([fpath fname]);
imshow(i);hold on;

if (size(i,3)>1)
i=rgb2gray(i);
end
h1 = impoint(gca, []);
pos = getPosition(h1);
h2 = impoint(gca,[]);
pos2 = getPosition(h2);

this has two problems:

1>> this allows to move the points but doesn't give the final co-ordinates.

2>> the point marked by the impoint function is too large.
so what should I do??