Minimum distance between two Irregular forms

3 ビュー (過去 30 日間)
mohammed alany
mohammed alany 2019 年 3 月 31 日
コメント済み: mohammed alany 2019 年 4 月 1 日
WHAT is the min distance between these two shapes?
note: i know the connecting points of big figure.
didnot.jpg

採用された回答

Image Analyst
Image Analyst 2019 年 3 月 31 日
編集済み: Image Analyst 2019 年 4 月 1 日
If you have the stats toolbox, try this:
distances = pdist2(xyShape1, xyShape2)
minDistance = min(distances(:))
[minRows, minColumns] = find(distances == minDistance)
  18 件のコメント
Walter Roberson
Walter Roberson 2019 年 4 月 1 日
[minDistance, minColumns] = min(distances);
minColumns is already a vector.
Note: you might need min(distances,2) depending on whether you need the minimum distance from each point in the first to any point in the second, or the minimum distance from each point in the second to any point in the first.
When you do a single min() call and the try to use find(), then that could be appropriate for the case where one point might happen to be exactly the same minimum distance to two more or points in the other shape, and you need to know all of them. In a situation such as that, you would generally get a different number of minimum points for each, which is a bit tricky to represent in a rectangular numeric matrix. Is this the situation that applies for you, that you need to know all of the points that are the same minimum distance? If so then typically a loop would be easiest.
mohammed alany
mohammed alany 2019 年 4 月 1 日
many thanks, now it's work correctly.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by