I have a 2D array in Python containing values of either 0 or 1, arranged to form various shapes. For my current project I need a method to distinguish between the shapes in the image.
I am currently attempting to do this by setting the values of the first shape to 1, the second shape values to 2 and so on. However, this is proving too difficult for me to code, so I was wondering if anyone knew a good algorithm to do this, or knew of another method. Thanks.