Skip to content
Advertisement

Problems in traversing contours in python using OpenCV library

I am designing an algorithm in which I have to traverse through every contour in an image and apply a condition on it. I am using OpenCV library to do this. And the code is as follows:

JavaScript

The error is:

JavaScript

Advertisement

Answer

I have never used h_next but whenever I’ve iterated over contours

JavaScript

has worked.

It appears that you’re mixing the iterator n_next with [i]…try the following

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement