# [Numpy-discussion] coding Turk&Pentland equation

harryos oswald.harry@gmail....
Wed Apr 2 02:00:08 CDT 2008

```i was trying to code the equation 7 of Turk,Pentland paper 'eigenfaces
for recognition' The equation says for an image l ,the components in
eigen space is wk=uk.T (l-Psi) where uk is a single eigenface vector
and Psi is the average image

i have an ndarray L that contains data of 1 image per row. if there
are M total images  each of N pixels ,then L is of shape(MxN)
I calculated eigenfaces(U) such that each row is an eigenface(ie,uk)
U is of shape(MxN)

I saw in a posting
that
The components in 'face-space' of a face image I (Nx 1 vector) are
wk = uk o (I - Psi), where Psi is the average over the M face images;
o denotes scalar product, uk is eigenface k.

but here i am using each image as 1xN vector  .And i want to take only
m eigenfaces instead of M. how should i calculate the weight space
from this ?should i do
W=dot(U[:m,:],(L-Psi).transpose() )
do i have to transpose this result again?

thanks
harryos
```