Display hierarchy lvl on contour.
Hello,
I'm learning the hierarchy on python. I'd like to see the hierarchy lvl for each contour like on this site : https://docs.opencv.org/master/d9/d8b... I have this picture : Then i find contours then their hierarchy :
hierarchy [[[ 1 -1 -1 -1] [ 2 0 -1 -1] [ 3 1 -1 -1] [ 4 2 -1 -1] [ 5 3 -1 -1] [-1 4 -1 -1]]]
I suppose since i have 6 shapes, I have 6 contours (0 to 5). To understand this array i'd like the display these numbers on my picture.
Have you an idea to do this ?
Thanks.
see this code i think you can change it according to your needs
you image is a bad example, it has no hierarchy at all (there is nothing "nested") so the parent and child entries are all -1