You need to complete the following steps:
- Import the modules:
import cv2import numpy as np
- Generate a fourth degree polynomial equation:
N = 4coeffs = np.random.randn(N+1,1)
- Find all the roots in the complex domain:
retval, roots = cv2.solvePoly(coeffs)
- Check the roots:
for i in range(N): print('Root', roots[i],'residual:', np.abs(np.polyval(coeffs[::-1], roots[i][0][0]+1j*roots[i][0][1])))