Peter Skomoroch peter.skomoroch@gmail....
Tue Mar 11 22:08:45 CDT 2008

```I found this in my del.icio.us links, sorry I forgot to mention it at the
time:

http://www.owlnet.rice.edu/~elec301/Projects99/faces/code.html

All the best

On Thu, Mar 6, 2008 at 10:39 AM, devnew@gmail.com <devnew@gmail.com> wrote:

> 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
>
>
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>

--
Peter N. Skomoroch
peter.skomoroch@gmail.com
http://www.datawrangling.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080311/01f93859/attachment.html
```