Advertisement
SimonMage

Verificare equiluminosità (2)

Nov 17th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. def eqLum(pict1,pict2):
  2. # @pict1: Picture
  3. # @pict2: Picture
  4. # @return: Boolean; Se esce Vero, allora esiste almeno un colore equiluminoso nella seconda immagine
  5.   allPix1 = getPixels(pict1)
  6.   allPix2 = getPixels(pict2)
  7.   for p2 in allPix2:
  8.     lum2 = (getRed(p2)+getGreen(p2)+getBlue(p2))
  9.     if existEqLum(lum2,allPix1)==True:
  10.       return True
  11.     return False
  12.    
  13.  
  14. def existEqLum(lum2,allPix1):
  15. # @lum2: Int
  16. # @allPix1: Pixels's sequence
  17. # @return: Boolean
  18.   for p1 in allPix1:
  19.     lum1 = (getRed(p1)+getGreen(p1)+getBlue(p1))
  20.     if lum1==lum2:
  21.       return True
  22.     return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement