How it works...

Systems of linear equations can be solved using OpenCV's cv2.solve function. It accepts a coefficients matrix, the right-hand side of the system, and optional flags, then returns a solution (the success indicator and solution vector, to be exact). As you can see in the first example, it can be used to solve systems with unique solutions.

You can specify the cv2.DECOMP_NORMAL flag, in which case an internally normalized system of linear equations will be constructed. This can be used to solve over-determined systems with one or no solutions, in the latter case, the least squares problem's solution is returned.

An under-determined system of linear equations has either no or multiple solutions. In the preceding code, we constructed ...

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.