implement the distance transform algorithm by City-Block distance measurement
15 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi Guys I have an assignment to implement the distance transform algorithm by City-Block distance measurement I tried a lot of solutions but it didn't work (That's the photo)

2 commentaires
Réponses (2)
Walter Roberson
le 1 Avr 2022
City block transform between rows of P1 and corresponding rows of P2 is
CB = @(P1, P2) sum(abs(double(P1)-double(P2)), 2)
0 commentaires
Image Analyst
le 2 Avr 2022
I don't know if you want the distances between the centroids of the blobs
props = regionprops(mask, 'Centroid');
xy = vertcat(props.Centroid);
or between all the white pixels in the image.
[y, x] = find(mask);
xy = [x(:), y(:)];
But you can use pdist2
distances = pdist2(xy, xy, 'CityBlock');
0 commentaires
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!