MATLAB: Creating approximation line between objects.

creating lineimage processingImage Processing Toolbox

Hello, I have image with a few objects I measured centroids of each one, now I want to create approximation line using centroids. Do you have any ideas how could I do that? Thank you in advance.

Best Answer

Compute the centroids with regionprops(). Then pass those into polyfit(). Then use polyval() to get coordinates along the line.