Re: using PIL for PCA analysis

2009-01-13 Thread Jan Erik Solem
> if i want to do an array of PIL image data i can use > img=Image.open("myimg.jpg") .convert("L") > pixelarray=img.getdata() > convert("L") is a good way to make images grayscale. An option to using getdata() is to try numpy's array: pixelarray = numpy.array(img) this gives lots of possibiliti

Re: using PIL for PCA analysis

2008-02-26 Thread harryos
>Paul McGuire wrote > # following approx fromhttp://www.dfanning.com/ip_tips/color2gray.html > grayscale = lambda (R,G,B) : int(0.3*R + 0.59*G + 0.11*B) > print [ [ grayscale(rgb) for rgb in row ] for row in sampledata ] Paul in PIL handbook ,they mention a Luma transform on page15, under the im

Re: using PIL for PCA analysis

2008-02-21 Thread Paul McGuire
On Feb 21, 1:41 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > hi guys > i am trying out  PCA analysis using python.I have a set of > jpeg(rgbcolor) images whose pixel data i need to extract and make a > matrix .( rows =num of images and cols=num of pixels) > For this i need to represent an i

Re: using PIL for PCA analysis

2008-02-21 Thread [EMAIL PROTECTED]
On Feb 21, 7:35 pm, "Bronner, Gregory" <[EMAIL PROTECTED]> wrote: you can do this using numpy and scipy > fairly easily, and you can transform PIL arrays into Numpy arrays pretty > quickly as well. > i can use numpy ndarray or matrix once i have a PIL array with elements in the correct format(ie a

RE: using PIL for PCA analysis

2008-02-21 Thread Bronner, Gregory
Since nobody has responded to this: I know nothing about PIL, but you can do this using numpy and scipy fairly easily, and you can transform PIL arrays into Numpy arrays pretty quickly as well. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, Februa

Re: using PIL for PCA analysis

2008-02-21 Thread Matthieu Brucher
Hi, You should convert your data to numpy and make it 1D (for the moment, it is 3D) by calling the ravel() method. Then you can create your covariance matrix ;) Matthieu 2008/2/21, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > hi guys > i am trying out PCA analysis using python.I have a set of > j