numpy.linalg.inv error

asked 2020-09-05 01:40:37 -0600

hoseinimage gravatar image

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

edit retag flag offensive close merge delete

Comments

what are you trying to achieve with the dot product ?

(we also cannot help you with numpy or pycharm problems)

berak gravatar imageberak ( 2020-09-05 10:07:53 -0600 )edit

you say np.linalg.inv(other_dict). show me other_dict. is it REALLY a matrix?

crackwitz gravatar imagecrackwitz ( 2020-09-07 11:25:38 -0600 )edit

also fix the formatting of your code. your indentation is mangled. this destroys the code.

crackwitz gravatar imagecrackwitz ( 2020-09-07 11:26:51 -0600 )edit