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?

답변 (1개)

Image Analyst
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
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.

댓글을 달려면 로그인하십시오.

제품


릴리스

R2015a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by