Ask Your Question

Revision history [back]

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/tutorial_py_contours_hierarchy.html I have this picture : image description 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.