How to calculate distance between center of white pixels in an image?
Show older comments
In this iamge, I want to measure the distance between the center of area of white pixels marked below.
As these are not definite shapes, how do I find the center of these and then measure the distance in pixels between their centers.

Accepted Answer
More Answers (1)
Teja Muppirala
on 22 Jul 2019
1 vote
You can find the center (centroid) of each white region using REGIONPROPS, and then just calculate the distance between the centers that regionprops returns.
Categories
Find more on Image Arithmetic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!