I have the below image in a numpy array
I want to
separate the blocks into individual contours or any coordinate representation.
I then want to transform any concave polygons into multiple convex polygons.
Like this
So far I've managed to isolate each block into contours with opencv... but is there an easy way to split the L shape objects into two or more square blocks. The new contours of each shape can overlap if needed.
It may also be the case that I have an Image like this which does not have such straight lines.
I have used cv2.approxPolyDP
to draw the shape, but again they are concave and I need them splitting.
Any help appreciated.
Ok so thanks Rahul for your answer.
I ended up finding a package that helped me trangulate the polygons which solved my issue.
download with :
Then :
Take the contours generated by openCV - this generates them as below.
Then "smooth" the colours so there are less of them. I've used this
then run it through sect
The output splits the polygons into triangles removing ALL concave polygons totally.