Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from immagini import *
- def quadrato(filename,c):
- '''Implementare qui la funzione'''
- img = load(filename)
- for y,line in img:
- for x,pixel in line:
- if x != colore:
- continue
- end = start
- end = (y,x)
- while True:
- if len(img[x]) - 1) < end[0]+1 or len(img[y]) - 1) < end[1]+1:
- break
- if len(set(img[end[0]][x:end[1]])) is not 1:
- break
- valid = True
- for linefigure in img[y:end[0]+1]:
- if linefigure[end[1]+1] != c:
- valid = False
- break
- if valid = False:
- break
- end = (end[0] + 1, end[1]+1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement