How do I translate a 2D shape to its centroid?

1 回表示 (過去 30 日間)
Cai Chin
Cai Chin 2020 年 12 月 11 日
回答済み: Image Analyst 2020 年 12 月 12 日
Hi, I am using MATLAB R2020a on a MacOS. I am attempting to translate the blue shape shown here about its centroid onto the orange shape for comparison of the morphologies of these 2 plots, but I am unsure as to how to do this:
Any suggestions would be greatly appreciated. Thanks in advance

採用された回答

Image Analyst
Image Analyst 2020 年 12 月 12 日
Try this:
meanBlueX = mean(vBlue); % x
meanBlueY = mean(wBlue); % y
meanOrangeX = mean(vOrange); % x
meanOrangeY = mean(wOrange); % y
% Shift the blue by subtracting blue mean and adding in orange mean.
vBlue = vBlue -meanBlueX + meanOrangeX;
wBlue = wBlue -meanBlueY + meanOrangeY;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by