Advertisement
Guest User

Untitled

a guest
May 21st, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. def luminosite(image):
  2. lum = 0
  3. pix = image.load()
  4. x,y = image.size
  5. for i in range(x) :
  6. for j in range(y) :
  7. lum += pix[i,j]
  8. return lum / (x*y)
  9.  
  10. def analyse(folder,dark):
  11. files = [f for f in sorted(glob.glob(folder + "**/*.TIFF", recursive=True))]
  12. Lum=[]
  13. for f in files:
  14. imgf=filtre(f,dark)
  15. l = luminosite(imgf)
  16. Lum.append(l)
  17. return Lum
  18.  
  19. def filtre(image, dark) :
  20. img = Image.open(image)
  21. dark = Image.open(dark)
  22. img_filtre=img.load()-dark.load()
  23. return img_filtre
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement