Finding the distances between two boundaries

13 visualizaciones (últimos 30 días)
Hao Shi
Hao Shi el 15 de Mayo de 2021
Comentada: Hao Shi el 16 de Mayo de 2021
Hi there,
I have an expanding object, which shows different contours at different time. In this case, I would like to analyze its expansion speed at all sides.
Firstly, these two contours at two adjacent time are binarized and shown below.
  • Boundary 01
  • Boundary 02
Secondly, I got the outline coordinates along these two contours using the edge() function. At the same time, I plotted the gradient arrows started from the first contour, to show the expanding directions at different sides. A part is shown as follows.
My question is, how to find the pairwise coordinates from the second (the larger one, black) contour? Where it is exactly the point of intersection or the one is closest to the arrow expansion line. After locating the pairwise point, we may need to adjust the gradient arrow a little bit, and measure its length to indicate the expanding speed. Thank you in advance!

Respuesta aceptada

Image Analyst
Image Analyst el 15 de Mayo de 2021
To get a list of (row, column) coordinates for blobs in a binary image you can do
boundaries = bwboundaries(mask);
% To find the distance between every point in blob #1 to every point in blob #2, you can do this:
% First get x and y for blob #1
b1 = boundaries{1};
x1 = b1(:, 2);
y1 = b1(:, 1);
% First get x and y for blob #1
b2 = boundaries{2};
x2 = b2(:, 2);
y2 = b2(:, 1);
% Now find the distances between all pairs of points
distances = pdist2([x1, y1], [x2, y2]);
Hope you can take it from there.
  3 comentarios
Image Analyst
Image Analyst el 16 de Mayo de 2021
If you have an initial point, P1a, and a gradient vector, you can draw a line through the point P1a, at the slope of the gradient, all the way through the image. Then for each point along that straight line, use pdist2() to find out which pair of points (P1b on the line and P2 on the next, expanded or shrunken curve) has the minimum distance. Basically you're finding out which point P2 corresponds to point P1a on the original curve and in a direction specified by the gradient vector.
Now that you know the index of the point on the second curve, you can compute the distance from that point to the original point P1a. And the speed if you know the time between the curves.
Hao Shi
Hao Shi el 16 de Mayo de 2021
It works, and the preliminery result is shown as below. Please let me know if you have more fantastic ideas, thank you very much!

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by