How can i measure the distance of each pixel of a binary image from a specified co-ordinate?
조회 수: 3 (최근 30일)
이전 댓글 표시
I'm trying to measure error in roundness. I have got a point i.e., the center point co-ordinates(Xc,Yc). Now from this point i have to measure the distance of each pixel of the circle geometry so as to get the mean radius. So can anyone help me?
댓글 수: 0
답변 (1개)
Image Analyst
2019년 2월 18일
편집: Image Analyst
2019년 2월 18일
Use sqrt() with the coordinates of the binary image
distances = sqrt((x-Xc).^2 + (y-Yc).^2);
You can also use regionprops(binaryImage, 'EquivDiameter') to get the mean radius
props = regionprops(binaryImage, 'EquivDiameter')
allDiams = [props.EquivDiameter];
averageRadii = allDiams / 2;
댓글 수: 5
Dina Abd El-twab
2020년 4월 11일
I want the distance to be in millimeters(mm) not in pixels
Can we contact in this link ? It is a new question
https://in.mathworks.com/matlabcentral/answers/517136-measure-the-maximum-distance-in-millimeters-mm
Image Analyst
Image Analyst
2020년 4월 11일
Then you need to multiply by the number of millimeters per pixel:
props = regionprops(binaryImage, 'BoundingBox')
width = props.BoundingBox(3) * mmPerPixel;
See attached demo.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!