1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| import PIL
import Image
import numpy
import colorsys
import psyco
image=Image.open("c:\\a.jpg")# Ouverture de l'image im19.jpg
#image.show()
r,g,b=image.split()# Récupération des différentes composantes de l'image
larg,haut=r.size
#r.show()
#g.show()
#b.show()
r=numpy.array(r)
#r=numpy.reshape(r,(haut,larg))
g=numpy.array(g)
#g=numpy.reshape(g,(haut,larg))
b=numpy.array(b)
#b=numpy.reshape(b,(haut,larg))
for i in range (0,(r.shape[0]-1)):
for j in range(0,(r.shape[1]-1)):
#print "i"=,i,"j"=,j
h,s,v=colorsys.rgb_to_hsv(r[i,j],g[i,j],b[i,j])
print h,s,v |
Partager