Ask Your Question
0

TypeError:'NoneType' object cannot be interpreted as an integer

asked 2018-06-05 01:23:48 -0600

Madhu Pasula gravatar image

Can any one help me in resolving this issue: for contour, hier in zip(itertools.repeat(contours, hierarchy)):

TypeError: 'NoneType' object cannot be interpreted as an integer

my code snippet:

_, contours, hierarchy = cv2.findContours(erosion,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)         
for contour, hier in zip(itertools.repeat(contours, hierarchy)):
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-06-05 01:42:43 -0600

berak gravatar image

your code does not make any sense.

if cv2.RETR_EXTERNALis used, you get a flat list of contours, and hierarchy is simply None. IF you would have used cv2.RETR_TREE, you would need to recursively traverse the hierarchy, your zip() attempt does not make any sense here.

also, trying a simple help(itertools.repeat) before asking would have pointed you at the problem already.

please have a look at the tutorials

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-06-05 01:23:48 -0600

Seen: 4,321 times

Last updated: Jun 05 '18