Good morning. I want apply a KLT on python for one random image.
import cv2
import numpy as np
img = cv2.imread('Lenna_(test_image).png', 0)
eigenVal, eigenVec = np.linalg.eig(np.cov(img))
column = []
for x in range(img.shape[0]):
column.append(img[:, x])
y = eigenVec.T * (column - np.sum(img) / img.shape[0])
klt = np.dot(eigenVec, img)
cv2.imshow("klt", y) # 1° solution
cv2.imshow("KLT", klt) # 2° solution
cv2.waitKey(0)
cv2.destroyAllWindows()
I just want to know if the process is right.
Thanks.