Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. from immagini import *
  2.  
  3. def quadrato(filename,c):
  4. '''Implementare qui la funzione'''
  5. img = load(filename)
  6. for y,line in img:
  7. for x,pixel in line:
  8. if x != colore:
  9. continue
  10.  
  11. end = start
  12. end = (y,x)
  13. while True:
  14. if len(img[x]) - 1) < end[0]+1 or len(img[y]) - 1) < end[1]+1:
  15. break
  16. if len(set(img[end[0]][x:end[1]])) is not 1:
  17. break
  18. valid = True
  19. for linefigure in img[y:end[0]+1]:
  20. if linefigure[end[1]+1] != c:
  21. valid = False
  22. break
  23. if valid = False:
  24. break
  25.  
  26. end = (end[0] + 1, end[1]+1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement