Search code examples
c#connected-components

Algorithm to differentiate parts that are separated?


Let's say I have an image with some shapes on it. Is there any algorithm that knows that there are multiple shapes on it, based on if they are separated or not?

An example of my goal


Solution

  • I used an algorithm called "connected component labeling". I used these intructions for the implementation: https://towardsdatascience.com/implementing-a-connected-component-labeling-algorithm-from-scratch-94e1636554f