How to calculate distance between center of white pixels in an image?
조회 수: 1 (최근 30일)
이전 댓글 표시
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.![cmm_wo_circles.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/230726/cmm_wo_circles.jpeg)
![cmm_wo_circles.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/230726/cmm_wo_circles.jpeg)
댓글 수: 0
채택된 답변
KSSV
2019년 7월 22일
REad about imdistline; this will allow you to calculate the distance between the points interactively. For this you are supposed to have image toolbox.
[y,x] = find(I==1) ; % give the pixel value
The above line, gives you the coordinates/ points of the required pixel. YOu have the points in hand, you can do the process needed.
댓글 수: 2
추가 답변 (1개)
Teja Muppirala
2019년 7월 22일
You can find the center (centroid) of each white region using REGIONPROPS, and then just calculate the distance between the centers that regionprops returns.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!