現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
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!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)
