Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- im1=Image.open("rouge1.jpg")
- L,H=im1.size
- im2 = Image.new ("RGB",(L,H))
- S=int(input("Entrer un seuil de nuance de rouge: "))
- for y in range(H):
- for x in range(L):
- p = im1.getpixel((x,y))
- LUM=0,21*p[0]+0,71*p[1]+0,7*p[2]
- if p[0]>p[1] and p[0]>p[2] and p[0]<S:
- im2.putpixel((x,y), (LUM,LUM,LUM))
- else:
- im2.putpixel((x,y), (p[0],p[1],p[2]))
- im2.save("image-seuillee.pgm")
- im2.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement