devnew@gmai... devnew@gmai...
Thu Mar 6 08:39:56 CST 2008

```ok..I coded everything again from scratch..looks like i was having a
problem with matrix class
when i used a matrix for facespace
and trying to convert the row to an image (eigenface).
by
make_simple_image(facespace[x],"eigenimage_x.jpg",(imgwdth,imght))
.i was getting black images instead of eigenface images.

def make_simple_image(v, filename,imsize):
v.shape=(-1,) #change to 1 dim array
im = Image.new('L', imsize)
im.putdata(v)
im.save(filename)

make_simple_image(asarray(facespace[x]),"eigenimage_x.jpg",
(imgwdth,imght))
this produces eigenface images

another observation,
the eigenface images obtained are too dark,unlike the eigenface images
generated by Arnar's code.so i examined the elements of the facespace
row

sample rows:
[ -82.35294118,  -82.88235294,  -91.58823529 ,...,  -66.47058824,
-68.23529412,  -60.76470588]
..
[  89.64705882   82.11764706   79.41176471 ...,  172.52941176
170.76470588  165.23529412]

looks like these are signed ints..

i used another make_image() function that converts the elements
def make_image(v, filename,imsize):
v.shape = (-1,)	#change to 1 dim array
a, b = v.min(), v.max()
span = max(abs(b), abs(a))
im = Image.new('L', imsize)
im.putdata((v * 127. / span) + 128)
im.save(filename)

This function makes clearer images..i think the calculations convert
the elements to unsigned 8-bit values (as pointed out by Robin in
another posting..) ,i am wondering if there is a more direct way to
get clearer pics out of the facespace row elements

```