Open zt823793279 opened 3 years ago
Hi,
Thank you for pointing it out and I apology for the mistake. This is a toy project for one of my courses in university years ago, and I have left the area. So I am afraid I am not able to solve it...
If you would like to pull a request to fix this mistake, I’d thank you greatly for that and accept it. Or I’ll leave this issue open and make a note in the readme file to prevent future confusion.
There is a problem with your code
imgs 是三维的图像矩阵,第一维是图像的个数 ''' def TwoDPCA(imgs, dim): a,b,c = imgs.shape average = np.zeros((b,c)) for i in range(a): average += imgs[i,:,:]/(a1.0) G_t = np.zeros((c,c)) for j in range(a): img = imgs[j,:,:] temp = img-average G_t = G_t + np.dot(temp.T,temp)/(a1.0) w,v = np.linalg.eigh(G_t)
print('v_shape:{}'.format(v.shape))