I have some image processing that allows me to extract a binary image containing thick segments and i'm facing the issue that these segments may cross each other. Hence I need to find an efficient way to separate them, i'll have to implement this in C++ so anything OpenCV-based would help.
Here is a sample input image, both "blobs" would need to be split in 3 different segments.
I have tried 2 ideas until now, I'm stuck with both of them and that's why I'm asking here if there are any "state of the art" solution to this apparently simple problem.
My first idea was to compute the skeleton of the blobs, find intersection points. This part was easy. Then I planned to start with an end-point, traverse the segment until I reach an intersection and "cross the intersection". If you look at the bottom blob, the skeleton can produce weird "Y" shapes even when a "T" shape was expected, making it impossible to decide how to traverse an intersection.
Second idea was to compute the distance transform, followed by the gradient direction, and then I still need a way to merge pixels with similar direction and a way to handle endpoints / intersections.