Reputation: 3804
I am trying to implement the Lucas Kanade algorithm for some project without using any library. I am following this guide from opencv.
I am stuck in translating least square equation which is below.
I am not sure below code is correct method to compute equation?
inv(X)*np.matrix(T)
where
If yes please acknowledge me. If not please provide show how to do it using numpy or scipy.
I am not sure how to validate the correctness of least square. Otherwise I would not have asked this question
Upvotes: 2
Views: 1117
Reputation: 56
I am assuming you have created the two matrices (the first matrix X and the second matrix T) on the right hand side of the equation. Once you have the two matrices, you can do something like this
import numpy as np
uvVector = np.dot(np.linalg.inv(X), T)
np.dot does matrix multiplication.
Upvotes: 3