Skip to Content
Learn Robotics Programming
book

Learn Robotics Programming

by Danny Staple
November 2018
Beginner
472 pages
13h 5m
English
Packt Publishing
Content preview from Learn Robotics Programming

Find contours

In OpenCV 2.4.9 this function has the signature (arrangement of parameters and return values) of:

contours, hierarchy = cv.findContours(image, mode, method[, contours[, hierarchy[, offset]]] ).

We copy the image because this function will modify the image with outlines as it finds the contours in it.

In OpenCV 3, findContours now has a different return value:

image, contours, hierarchy = cv.findContours(image, mode, method[, contours[, hierarchy[, offset]]]).

The original image is not altered. An additional image (which can be ignored if you don't want it: Python will dispose of it) is returned, which has the same changes the old OpenCV version would have made.

With this changed, the code should now function well with OpenCV ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn Robotics Programming - Second Edition

Learn Robotics Programming - Second Edition

Danny Staple

Publisher Resources

ISBN: 9781789340747Supplemental Content