Advertisement
MaxDvc

luminanceCheck

Nov 8th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. def luminanceCheck(pict1,pict2):
  2. #@param:
  3. #   pict1, pict2: picture;
  4. #   return: bool;
  5.     allPix1 = getPixels(pict1)
  6.     allPix2 = getPixels(pict2)
  7.     for i in allPix1:
  8.         a = False
  9.         x1 = getX(i)
  10.         y1 = getY(i)
  11.         p1 = getPixel(pict1,x1,y1)
  12.         for j in allPix2:
  13.             x2 = getX(j)
  14.             y2 = getY(j)
  15.             p2 = getPixel(pict2,x2,y2)
  16.             if lumCheck(p1,p2):
  17.                 a = True
  18.                 return a
  19.         if not a:
  20.             return False
  21.  
  22. def lumCheck(pix1,pix2):
  23. #@param:
  24. #   pix1, pix2: pixel;
  25. #   return: bool;
  26.   if luminance(pix1) == luminance(pix2):
  27.     return True
  28.   else:
  29.     return False
  30.  
  31. def luminance(pix):
  32. #@param:
  33. #   pix: pixel
  34. #   return: int, luminance;
  35.     r = getRed(pix)
  36.     g = getGreen(pix)
  37.     b = getBlue(pix)
  38.     luminance = (r+g+b)
  39.     return (luminance)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement