using PIL for PCA analysis

Jan Erik Solem jesolem at gmail.com
Tue Jan 13 05:16:35 EST 2009




> 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 possibilities for working with the images numerically,
like for PCA. (see example code in the link below)



> 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?
> 
I wrote a short script for doing PCA on images using python, with some
explanations and example code 
http://jesolem.blogspot.com/2009/01/pca-for-images-using-python.html here .
Could be of help to you guys. 

-- 
View this message in context: http://www.nabble.com/using-PIL-for-PCA-analysis-tp15606311p21432675.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list