이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
how can i calculate distance between two points on an image
조회 수: 3 (최근 30일)
이전 댓글 표시
hallow
i want to calculate distance between two point on a body image. and to measure angle between two lines on an image............
답변 (2개)
Image Analyst
2014년 1월 9일
Use imdistline() to do it interactively. Or use hypot() or sqrt() if you know the coordinates.
댓글 수: 43
Saliha
2014년 1월 11일
i want multiple point's measurement on a single image ...... compare and compute their value and then want to save their value for further use... imdistline() draws only single line.
Image Analyst
2014년 1월 11일
Well, how do you expect those lines to get there ?
If you know where they are already, just use hypot() or sqrt() like I said.
Saliha
2014년 1월 12일
편집: Walter Roberson
2014년 1월 21일
i want to calculte something like this....
please visit this image...

i want to calculte distance between two feets, angle of knee and hip to which extent these bend during walk... and want differentiate using some geometrical mthods.
Image Analyst
2014년 1월 12일
Link doesn't work. And I believe I answered the question about how to find distances between two points: use imdistline to do it interactively or use sqrt() if you know the locations from some other method, like image segmentation or whatever.
Image Analyst
2014년 1월 12일
You didn't ask how to find the vertices, only how to measure the distance between them. Presumably you're following some paper that tells you how to find the vertices. Anyway, I don't know how - I'd have to look up some papers just like you're probably doing.
Saliha
2014년 1월 13일
right.... I'm following and I've some innovative idea on it. but i don't know how to calculate and evaluate to satisfy my point..................
Saliha
2014년 1월 13일
actually i want to give these point as mouse input and after that want different calculations on it....... kindly tell me how it is possible using matlab........
Image Analyst
2014년 1월 13일
편집: Image Analyst
2014년 1월 13일
Please reread my answer. That tells you how. If you think it doesn't, then please explain why. I don't know if you overlooked in the help that imdistline() lets the user specify endpoints with the mouse. And I'm sure you learned the Pythagorean theorem in high school - it uses sqrt(). It shouldn't be very hard at all, but if you need me to actually write the lines of code for you, let me know. Try to adapt the examples in imdistline().
Saliha
2014년 1월 15일
I've run an example but.......... can't drive my desired point .... don't know that by taking this topic I'll fall in maze :'(
Saliha
2014년 1월 15일
but if u know about any software of "gait analysis or recognition" then pleaseeeeeeeeeeeeeee send me I'll be thankful :(
Image Analyst
2014년 1월 15일
16.7.4.5 Walking, Gait Recognition, Gait Analysis
16.7.4.5.1 Walking, Gait Recognition, University of Southampton
16.7.4.5.2 Cyclic Motion, Periodic Motion, for Walking and Gait Recognition
16.7.4.5.3 Human ID Using Gait, Recognition of People Through Gait
16.7.4.5.4 Gait Analysis, Depth, 3-D Data, 3-D from Gait
16.7.4.5.5 Gait Analysis, Diagnosis of Difference, Joint Information, Motion Capture
16.7.4.5.6 Human Motion Capture, Joint Information, Special Activities
16.7.4.5.7 Human Motion Capture, Dance Activities
Saliha
2014년 1월 15일
are these links have software for gait ?????? or just papers etc?? i found nothing from these....
Walter Roberson
2014년 1월 15일
Image Analyst
2014년 1월 15일
Yeah, you'd think they could of chosen a better name. Of course, maybe that was on purpose.
Saliha
2014년 1월 20일
still i didn't find any solution :(
will u again suggest any idea by analyzing above picture ???
Image Analyst
2014년 1월 20일
If imdistline() is too challenging, you can use ginput() and sqrt():
imshow('cameraman.tif');
promptMessage = sprintf('Left-Click on the two points.');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');
if strcmpi(button, 'Cancel')
return;
end
[x, y] = ginput(2)
distance = sqrt((x(2)-x(1))^2 + (y(2)-y(1))^2)
message = sprintf('The distance is %.3f pixels.', distance);
uiwait(helpdlg(message));
Saliha
2014년 1월 21일
I've done it iteratively but at every iteration values of variables are being replaced.
Saliha
2014년 1월 21일
편집: Image Analyst
2014년 1월 21일
I'm unable to understand. would you like to elaborate? But i'll try to do it... if not succeeded then i'll consult again.
Image Analyst
2014년 1월 21일
Show the code for the loop and the array variable you want to set inside it.
Walter Roberson
2014년 1월 21일
for K = 1 : 10
[x(K,:) y(K,:)] = ginput(2)
distance(K) = sqrt((x(K,2)-x(K,1))^2 + (y(K,2)-y(K,1))^2)
ang(K) = atan2( y(K,2)-y(K,1), x(K,2)-x(K,1) );
message = sprintf('The distance is %.3f pixels, angle %.3f', distance(K), ang(K));
uiwait(helpdlg(message));
end
Saliha
2014년 1월 22일
편집: Walter Roberson
2014년 1월 22일
image analyst..............code is here... at every iteration values of x, y overwrite. i want to save all values.
n=9;
imshow('img.png');
promptMessage = sprintf('Left-Click on the two points.');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');
for i=1:n;
if strcmpi(button, 'Cancel')
return;
end
[x, y] = ginput(2)
distance = sqrt((x(2)-x(1))^2 + (y(2)-y(1))^2)
message = sprintf('The distance is %.3f pixels.', distance);
uiwait(helpdlg(message));
end
Walter Roberson
2014년 1월 22일
Use what I showed right above, except change "for K = 1 : 10" to "for K = 1 : n".
Note: your strcmpi() test should be before the "for" loop.
Saliha
2014년 1월 22일
walter roberson ............
this calculates angle from x and y xes. i want to calculate by giving both lines as input.... as shown in above image..... like < ..... this compute at single line
Walter Roberson
2014년 1월 22일
Geometrically, it is the product of the magnitudes of the two vectors and the cosine of the angle between them.
and that tells you that you can find the angle as arccos of the dot product divided by the product of the two magnitudes.
I was more concerned about showing you how to save the values which was the part you were having trouble with.
Note: In order to define the dot product, you need to have a starting point to calculate the distances to the two given points. You do not have that in your code: you only have the two points and you asked to find the distance between those two points; that will go directly from one point to another, not from one point to the branch point to the second point.
Saliha
2014년 1월 24일
can i use imdistlint with ginput?????? and still need help measuring angle between these drawn two lines.....
Image Analyst
2014년 1월 24일
imdistline can only handle two points. If you need 3, you can use imline() where you can daisy-chain any number of line segments.
Saliha
2014년 1월 24일
i want to use ginput() or somethign like this as parameter to imdistline().
and also want to use it Iteratively
Image Analyst
2014년 1월 24일
Okay, that's fine. ginput() gives giant crosshairs instead of rubber band line, but if that's what you want, that's fine.
Saliha
2014년 1월 24일
its good for me to see the code..... if u send as good gesture. I'll be thankful.
Image Analyst
2014년 1월 24일
I gave code for clicking on points, and Walter gave code for getting angle. Can't you combine them and get something that works? If you can't do that much, how are you going to do the rest of your algorithm, which I'm sure is probably going to be a lot more complicated than that?
Saliha
2014년 1월 25일
I've combined it . and run it many times. that angle is not calculated as i want. this calculate it from one point only. as getanglefromhorizontal() of imdistline().
Image Analyst
2014년 1월 25일
Attach your latest code and we might look at it over the weekend if we get time.
Walter Roberson
2014년 1월 25일
ginput(3) would allow the user to click on one limb, then click on the join at the body, and then click on the other limb; with the points and the order known, calculating the angle becomes a matter of applying the trig formula I gave earlier.
Usman Siddique
2017년 2월 16일
is u are still working on that project ?
댓글 수: 1
참고 항목
카테고리
Help Center 및 File Exchange에서 Basic Display에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
