필터 지우기
필터 지우기

How to find distance between two curves?

조회 수: 3 (최근 30일)
Jean Luo
Jean Luo 2016년 7월 13일
편집: Jean Luo 2016년 8월 1일
Hey guys, I have a set of binary images each consisting of two curves, one directly on top of the other. I want to find the normal distance between them. This is very similar to another question found here: https://www.mathworks.com/matlabcentral/answers/214151-how-to-find-the-distance-between-lines-in-a-image-in-matlab. I'm guessing I need to fit curves onto the image first. Any help would be much appreciated!
  댓글 수: 3
Image Analyst
Image Analyst 2016년 7월 13일
Do you want vertical distance or "radial"?
Jean Luo
Jean Luo 2016년 7월 13일
I'm thinking maybe finding the tangent lines to the highest points on the curves would be a good way to go, but do you have any ideas as to how I can find where the highest points are?

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

채택된 답변

Image Analyst
Image Analyst 2016년 7월 13일
I'd invert the image so that the curves are white (foreground). Then I'd make masks for each curve by dilating the image a bunch and using bwareafilt() to extract the 2 largest blobs. Then for each blob, mask the image of the original, undilated image so that you have only that blob. Then I'd use find() to get all the coordinates and then fit it to a circle to get an average radius. Then do the same for the other masked blob. Subtract the two radii to get the average, overall separation.
  댓글 수: 9
Image Analyst
Image Analyst 2016년 7월 22일
I gave you the formula for the radius. Here it is again:
meanRadii = mean(sqrt((x - xCenter).^2 + (y - yCenter).^2));
Recall that you said you have a known, specified center, so you know what xCenter and yCenter is. Don't you? I assume you did when you said "given the origin". Because if you just had the origin but not the center, then you'd just use the FAQ like I originally said.
No you don't need to use some circle fitting routine. The formula for radius I gave you is, in essence, the fitting code. It works because you have specified the center already so all we need to determine is the radius, which would just be the average of the distances of each point from your known center.
Jean Luo
Jean Luo 2016년 7월 22일
Thank you so much for your help, I got it to work!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by