Count and group points on 2d image.

Hello everyone,
I used an algotithm in order to detect the curvature of a racing circuit.
Now, I would like to count how many curves and straight there are. I used a threshold to discriminate the points of the curves and straight lines, obtaining the coordinates of the curves. I plot those points on the original image, obtaining this result
I add the number of the "cluster" that I would like to obtain. In the image there is an arrow that indicates a particular type of points, i.e. a "broken" curve. For the moment I would not consider the problem, considering the curves formed by at least by 2-3 points.
Thanks for answering.

 Accepted Answer

Not too hard. You can use bwlabel or regionprops to find, count, and get the lengths of each curvy portion. You just need to give an array where the index is true if the place is curvy and false if it's not curvy. Then
[labeled, numCurves] = bwlabel(mask);
props = regionprops(labeled, 'Area'); % Get length (# of elements) of each curve.
numCurves = numel(props); % Another way of counting curves.
If yoiu still can't figure it out then attach your vector of where the red + markers are.

More Answers (0)

Asked:

on 11 Dec 2022

Edited:

on 11 Dec 2022

Community Treasure Hunt

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

Start Hunting!