1.1 --- a/optimiser.py Sat Oct 10 16:04:09 2015 +0200
1.2 +++ b/optimiser.py Sat Oct 10 16:13:09 2015 +0200
1.3 @@ -28,27 +28,6 @@
1.4
1.5 # Image operations.
1.6
1.7 -def get_colours(im, y):
1.8 -
1.9 - "Get a colour distribution from image 'im' for the row 'y'."
1.10 -
1.11 - width, height = im.size
1.12 - c = {}
1.13 - for x in range(0, width):
1.14 - rgb = im.getpixel((x, y))
1.15 -
1.16 - # Sum the colour probabilities.
1.17 -
1.18 - for f, value in combination(rgb):
1.19 - if not c.has_key(value):
1.20 - c[value] = f
1.21 - else:
1.22 - c[value] += f
1.23 -
1.24 - d = [(n/width, value) for value, n in c.items()]
1.25 - d.sort(reverse=True)
1.26 - return d
1.27 -
1.28 def test():
1.29
1.30 "Generate slices of the colour cube."
1.31 @@ -93,24 +72,6 @@
1.32
1.33 return im.resize((width, height))
1.34
1.35 -def count_colours(im, colours):
1.36 -
1.37 - """
1.38 - Count colours on each row of image 'im', returning a tuple indicating the
1.39 - first row with more than the given number of 'colours' together with the
1.40 - found colours; otherwise returning None.
1.41 - """
1.42 -
1.43 - width, height = im.size
1.44 -
1.45 - for y in range(0, height):
1.46 - l = set()
1.47 - for x in range(0, width):
1.48 - l.add(im.getpixel((x, y)))
1.49 - if len(l) > colours:
1.50 - return (y, l)
1.51 - return None
1.52 -
1.53 def process_image(pim, saturate, desaturate, darken, brighten):
1.54
1.55 """