How do I translate a 2D shape to its centroid?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Cai Chin
le 11 Déc 2020
Réponse apportée : Image Analyst
le 12 Déc 2020
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
0 commentaires
Réponse acceptée
Image Analyst
le 12 Déc 2020
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 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!