Matab - Trace contour line between two different points
- by Graham
Hi,
I have a set of points represented as a 2 row by n column matrix.
These points make up a connected boundary or edge. I require a function that traces this contour from a start point P1 and stop at an end point P2. It also needs to be able trace the contour in a clockwise or anti-clockwise direction. I was wondering if this can be achieved by using some of matlabs functions.
I have tried to write my own function but this was riddled with bugs and I have also tried using bwtraceboundary and indexing however this has problematic results as the points within the matrix are not in the order that create the contour.
Thank you in advance for any help.
Btw, I have included a link to a plot of the set of points. It is half the outline of a hand.
The function would ideally trace the contour from ether the red star to the green triangle. Returning the points in order of traversal.