[Numpy-discussion] eigenface image too dark

Nadav Horesh nadavh@visionsense....
Wed Mar 19 04:51:44 CDT 2008


Easy solution:
   Use pylab's imashow(inputarray).
   In general ipython+matplolib are very handy for your kind of analysis

Longer solution:
   Scale your array:
     a_min = inputarray.min()
     a_max = inputarray.max()
     disp_array = ((inputarray-a_min)* 255/(a_max - a_min)).astype('uint8')\
      .
      .
      .
     newimg.putdata(disp_array)


    Nadav.

-----הודעה מקורית-----
מאת: numpy-discussion-bounces@scipy.org בשם royG
נשלח: ד 19-מרץ-08 08:23
אל: numpy-discussion@scipy.org
נושא: [Numpy-discussion] eigenface image too dark
 
hi
while trying to make an eigenface image from a numpy array of floats i
tried this

from numpy import array
import Image

imagesize=(200,200)
def makeimage(inputarray,imagename):
      inputarray.shape=(-1,)
      newimg=Image.new('L', imagesize)
      newimg.putdata(inputarray)
      newimg.save(imagename)

since i am using images of 200X200 size,
i use an array with 40000 elements  like
[ -92.35294118  -81.88235294  -67.58823529 ...,   -3.47058824
   -13.23529412   -9.76470588]
the problem is ,i get an image that is too dark.it looks like a face
but is too dark that even different arrays will create images that all
look alike!..
s there a way to 'tone it down' so that i can generate an eigenface
that can be displayed better?

thanks
RG
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion



More information about the Numpy-discussion mailing list