MATLAB: How to find out the distance between the inner and outer edge of the image using the Matlab command [x,y]=ginput(1)

image analysisimage processingMATLAB

Where ever you click on the following link image, matlab code must find out the two edges and find out the distance between the those two points using [x,y]=ginput(1). http://imageshack.us/photo/my-images/600/imfill.jpg

Best Answer

I gave you code for calling ginput() in http://www.mathworks.com/matlabcentral/answers/57292#answer_69661 that calculates the distance between two points. Recall where it said:
% Calculate diameters:
outerDiameter = sqrt((xOuter-xCenter)^2+(yOuter-yCenter)^2)
innerDiameter = sqrt((xInner-xCenter)^2+(yInner-yCenter)^2)
Well that's just the Pythagorean theorem. You can replace the two x and y with any any two x and y to get the distance between two points.