필터 지우기
필터 지우기

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

조회 수: 4 (최근 30일)
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

채택된 답변

Image Analyst
Image Analyst 2013년 1월 2일
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.
  댓글 수: 2
Naresh Naik
Naresh Naik 2013년 1월 3일
편집: Naresh Naik 2013년 1월 3일
But i don't know the center and how can i click mouse point at center in above link image?
I am not interested to find out the center by clicking it.
in this case can you find out the center by automatically?
Also not inttested to click the inner edge and outer edge by mouse pointer.
Just click on the circle (ONLY ONCE) at any point on it, code has take its center and find out the inner and outer dia without selectinig edges.
Whatever you suggested by clicking center,inner and outer edge so could we do the same thing by not selecting the points?
Image Analyst
Image Analyst 2013년 1월 3일
Looking up at the top (your original question here in this post right here), I believe I answered your question of how to find the distance between two points that you specified using ginput(), didn't I?
If you have a follow up to your prior question, where we showed you how to use regionprops(), then post your follow up question in that post, not this one.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Sean de Wolski
Sean de Wolski 2013년 1월 2일
I would just use imdistline()
  댓글 수: 11
Naresh Naik
Naresh Naik 2013년 1월 4일
편집: Walter Roberson 2013년 1월 4일
Here the code how i displayed the Area,FilledArea.....
imshow(I) (I=Inverted of binary image)
>> [L,num]=bwlabel(I);
>> regionprops(L,'Area','FilledArea')
ans = Area: 19363
FilledArea: 48540
>> sqrt(4*(Filledarea)/pi)
By using the above command i am getting the following error that is
??? Undefined function or variable 'Filledarea'.
How to eliminate above error?
(I mean how to write the code such that the above formula will take the FilledArea as 48540 and display the OD as 248 )
This is my question may be i didn't ask in proper way.

댓글을 달려면 로그인하십시오.


Walter Roberson
Walter Roberson 2013년 1월 3일
threshold. Logically negate so the circle becomes the 1's. bwboundaries that. The result for that image would be a 2 x 1 cell array, each entry of which is an array of row and column coordinates that together form one of the boundaries. Find the minimum of the euclidean distances between all points in the first cell and all points in the second cell, and you will have found the minimum distances between the inner and outer boundaries.
You can toss in a ginput(1) if you really want; you would just ignore the value it returns.

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by