Ask Your Question

Revision history [back]

numpy.linalg.inv error

hi i wrote these codes:

M, mask = cv2.findHomography(src_pts, dst_pts, cv2.RANSAC, 5.0)
homography = M, mask
camera = {
 "u0": 240,
 "v0": 320,
 "f0": 800,
 "fv": 800,

 }
def projection_matrix(homography):
global camera
other_dict = list(camera.items())
# Compute rotation along the x and y axis as well as the translation
homography = homography * (-1)
rot_and_transl = np.dot(np.linalg.inv(other_dict), homography)

but pycharm gives this error:

numpy.linalg.LinAlgError: Last 2 dimensions of the array must be square

I know my Two Matrices arent Square, Please Tell me How Convert Them into Square Matrices