Advertisement
Guest User

Untitled

a guest
Mar 5th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. from PIL import Image
  2. im1=Image.open("rouge1.jpg")
  3. L,H=im1.size
  4. im2 = Image.new ("RGB",(L,H))
  5. S=int(input("Entrer un seuil de nuance de rouge: "))
  6. for y in range(H):
  7. for x in range(L):
  8. p = im1.getpixel((x,y))
  9. LUM=0,21*p[0]+0,71*p[1]+0,7*p[2]
  10. if p[0]>p[1] and p[0]>p[2] and p[0]<S:
  11. im2.putpixel((x,y), (LUM,LUM,LUM))
  12. else:
  13. im2.putpixel((x,y), (p[0],p[1],p[2]))
  14. im2.save("image-seuillee.pgm")
  15. im2.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement