using PIL for PCA analysis

harryos oswald.harry at
Tue Feb 26 17:19:12 CET 2008

>Paul McGuire  wrote
> # following approx from
> 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 ]

in PIL handbook ,they mention a Luma transform on page15, under the
im.convert() section..
L = R * 299/1000 + G * 587/1000 + B * 114/1000
is that not similar to what you mentioned?(I am newbie in this area..)
if i want to do an array of PIL image data i can use"myimg.jpg") .convert("L")

thus i guess i can build a matrix of a set of  images
is there something wrong in the way i do this above?may be i can use
that to find covariance matrix for the set of images?


More information about the Python-list mailing list