In Matlab how to get input from an Image using ginput and calculate the distance

129 Views Asked by At

Cropped image

The image is after reducing noise and you can see two black dots in that image. What I'm trying to achieve is, using ginput i'll have to click those two dots and I need it to calculate the distance between them.

I did some search on this site and found this, but not working.

p = ginput(2);
sqrt(sum((p(:,1) - p(:,2)).^2))

I tried another method,but it ened up a failure too.

[x,y] = ginput(2);
distance = sqrt((x1-x2).^2+(y1-y2).^2);
disp(distance)

Any help would be appreciated.

0

There are 0 best solutions below