How it works...

Polynomial equations of degree n always have n roots in the complex domain (some of them can be repeated, however). All of the solutions can be found using the cv2.solvePoly function. It takes equation coefficients and returns all of the roots.

Here's an example of the expected output:

Root [[ 0.0494519   1.12199842]] residual: [  1.50920942e-16]
Root [[-0.17045556  0.        ]] residual: [ 0.]
Root [[ 0.0494519  -1.12199842]] residual: [  1.50920942e-16]
Root [[-8.1939051  0.       ]] residual: [  1.80133686e-14]

Get OpenCV 3 Computer Vision with Python Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.