Advertisement
SimonMage

Verificare equiluminosità (1)

Nov 17th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. def eqLum(pict1,pict2):
  2. # @pict1: Picture
  3. # @pict2: Picture
  4. # @return: Boolean; Vero se tutti i colori della prima immagine hanno un corrispettivo equiluminoso;
  5. #nella seconda, Falso se non esistono o non tutti lo hanno.
  6.   allPix1 = getPixels(pict1)
  7.   allPix2 = getPixels(pict2)
  8.   for p1 in allPix1:
  9.     lum1 = (getRed(p1)+getGreen(p1)+getBlue(p1))
  10.     if existEqLum(lum1,allPix2)==True:
  11.       return True
  12.   return False
  13.  
  14.  
  15. def existEqLum(lum1,allPix2):
  16. # @lum: Int
  17. # @allPix2: Pixels's sequence; Seconda immagine
  18. # @return: Boolean
  19.   for p2 in allPix2:
  20.     lum2 = (getRed(p2)+getGreen(p2)+getBlue(p2))
  21.     if lum1==lum2:
  22.       return True
  23.   return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement