How to compute centroidal distances

3 ビュー (過去 30 日間)
Elysi Cochin
Elysi Cochin 2018 年 1 月 3 日
回答済み: Image Analyst 2018 年 1 月 6 日
I wanted to compute centroidal distances, by calculating the distance is between the geometric centroid of the segmented object and the brightness centroid of the same.
% Is geometric centroid same as
s = regionprops(BW,'centroid');
what is brightness centroid

採用された回答

Matt J
Matt J 2018 年 1 月 3 日
編集済み: Matt J 2018 年 1 月 6 日
I assume you mean regionprops(BW, I ,'WeightedCentroid') ? You need an intensity image I, to invoke that option.

その他の回答 (1 件)

Image Analyst
Image Analyst 2018 年 1 月 6 日
You can use regionprops() and sqrt(), like this untested code:
props = regionprops(binaryImage, grayImage, 'Centroid', 'WeightedCentroid');
% Extract centroids into x and y from structure.
centroids = [props.Centroid];
xCentroids = centroids(1:2:end);
yCentroids = centroids(2:2:end);
weightedCentroids = [props.WeightedCentroid];
xWeightedCentroids = weightedCentroids(1:2:end);
yWeightedCentroids = weightedCentroids(2:2:end);
% Compute distances between the centroids and the weighted centroids.
distances = sqrt((xCentroids - xWeightedCentroids) .^2 + (yCentroids - yWeightedCentroids) .^ 2);

カテゴリ

Help Center および File ExchangeFeature Detection and Extraction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by