필터 지우기
필터 지우기

How to compute centroidal distances

조회 수: 2 (최근 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 CenterFile Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by