Watershed
This was mentioned from a F1TENTH lecture Raceline Optimization, you could use the watershed method to generate a centerline.
https://en.wikipedia.org/wiki/Watershed_(image_processing)
Use the skimage.segmentation.watershed
function:
https://scikit-image.org/docs/stable/api/skimage.segmentation.html#skimage.segmentation.watershed
AHH i finally get it! We plot it as a distance, and then imagine slowly filling the basins, until they meet. Then, those are the separations.
“In the example below, two overlapping circles are to be separated. To do so, one computes an image that is the distance to the background. The maxima of this distance (i.e., the minima of the opposite of the distance) are chosen as markers and the flooding of basins from such markers separates the two circles along a watershed line.