def solveBilinearTransform(points1, points2):
 import numpy.linalg
 A = np.array([[(points1[i].x() * points1[i].y()), points1[i].x(), points1[i].y(), 1] for i in range(4)])
 B = np.array([[points2[i].x(), points2[i].y()] for i in range(4)])
 matrix = np.zeros((2, 4))
 for i in range(2):
  matrix[i] = numpy.linalg.solve(A, B[:, i])
 return matrix

def solveBilinearTransform ( points1 , points2 ) : import numpy . linalg A = np . array ( [ [ ( points1 [ i ] . x ( ) * points1 [ i ] . y ( ) ) , points1 [ i ] . x ( ) , points1 [ i ] . y ( ) , 1 ] for i in range ( 4 ) ] ) B = np . array ( [ [ points2 [ i ] . x ( ) , points2 [ i ] . y ( ) ] for i in range ( 4 ) ] ) matrix = np . zeros ( ( 2 , 4 ) ) for i in range ( 2 ) : matrix [ i ] = numpy . linalg . solve ( A , B [ : , i ] ) return matrix
find a bilinear transformation matrix that maps points1 onto points2 .