Unpacking a variable number of 2D jagged numpy tuples (findcontours())

52 Views Asked by At

I'm using cv2.findcontours() which outputs a variable number of variable length Nx2 tuples.

For example, converting the tuples to a list:

    (array([[[100, 100]], ..., [[200, 200]]], dtype=int32), array([[[50, 50]], ..., [[300, 300]]], dtype=int32))

It's easy when you know the number of outputs to expect:

    a,b = cv2.findcontours()

I've tried awkward arrays, but I can't figure out how to access the arrays individually.

0

There are 0 best solutions below