How to compute centroidal distances
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Elysi Cochin
el 3 de En. de 2018
Respondida: Image Analyst
el 6 de En. de 2018
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
0 comentarios
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 6 de En. de 2018
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);
0 comentarios
Ver también
Categorías
Más información sobre Graph and Network Algorithms en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!